AspNetCore.Diagnostics.HealthChecks
AspNetCore.Diagnostics.HealthChecks copied to clipboard
[Bug] Dashboard doesn't load if app is served from sub-path
Please, fill the following sections to help us fix the issue
What happened:
If web app with the dashboard is configured to be served from some subpath (see IIS Configuration
bellow), it fails to load.
What you expected to happen:
Page successfully loads
How to reproduce it (as minimally and precisely as possible):
Program.cs:
app.MapHealthChecksUI(config =>
{
config.UIPath = "/"; // It doesn't matter what I put here, page doesn't load in any case
config.AddCustomStylesheet("Resources/corrigo.css");
});
IIS Configuration:
Source code sample:
Anything else we need to know?:
Workaround: Add /
to the end of the url (aka localhost/heartheat/
instead of localhost/heartheat
)
app.Use(async (context, next) =>
{
if (string.IsNullOrEmpty(context.Request.Path.Value))
{
context.Response.Redirect($"{context.Request.PathBase}/");
return;
}
await next();
});
Environment:
- .NET Core version: 6
- Healthchecks version: 6.0.4
- Operative system: Windows 10
- Others:
Same for me.
app.MapHealthChecksUI(x => {
x.ApiPath = "/diagnostics/healthchecks-api";
x.UIPath = "/diagnostics/healthchecks-ui";
});
Works: /diagnostics/healthchecks-api
Fails: /diagnostics/healthchecks-ui
Same here.