Hello,
i have a net 8 project and when I open the dashboard I get the error message: referrer policy strict-origin-when-cross-origin
Even after multiple searches on the web and numerous attempts, I cannot access the dashboard remotely.
The dashboard is displayed directly on the server via http://loacalhost:5000/hangfire.
builder.Services.AddCors(options =>
{
options.AddPolicy(“MyCorsPolicy”, policy =>
{
policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().AllowCredentials()
.WithOrigins([URL]);
});
});
// Enable CORS
app.UseCors(“MyCorsPolicy”);
app.Use(async (context, next) =>
{
if (context.Request.Path.StartsWithSegments(“/hangfire”))
{
context.Response.Headers.Remove(“Referrer-Policy”);
//context.Response.Headers.Add(“Referrer-Policy”, “no-referrer-when-downgrade”);
context.Response.Headers.Add(“Referrer-Policy”, “strict-origin-when-cross-origin”);
await next();
});