AspNetCore.Diagnostics.HealthChecks icon indicating copy to clipboard operation
AspNetCore.Diagnostics.HealthChecks copied to clipboard

[Bug] Dashboard doesn't load if app is served from sub-path

Open maxkoshevoi opened this issue 2 years ago • 1 comments

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: image

image

Source code sample:

Anything else we need to know?:

Workaround: Add / to the end of the url (aka localhost/heartheat/ instead of localhost/heartheat)

image

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:

maxkoshevoi avatar Jun 01 '22 13:06 maxkoshevoi

Same for me.

app.MapHealthChecksUI(x => {
  x.ApiPath = "/diagnostics/healthchecks-api";
  x.UIPath  = "/diagnostics/healthchecks-ui";
});

Works: /diagnostics/healthchecks-api
Fails: /diagnostics/healthchecks-ui

lonix1 avatar Jun 19 '22 03:06 lonix1

Same here.

isabellaalstrom avatar Jan 20 '23 15:01 isabellaalstrom