Skip to content

Dashboard is not working if the MapHealthChecks endpoint is protected. #2078

@abdulrahaman7

Description

@abdulrahaman7

We have used RequireAuthorization() to protect our health check API under MapHealthChecks endpoint. The internal call which happens from UI dashboard to get the data is failing as this API is protected. In this case how to get the data from protected health check API by passing the required credentials from UI dashboard.

Sample code:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapHealthChecks("/api/health", new HealthCheckOptions()
{
Predicate = (check) => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse,
})
.RequireAuthorization();

endpoints.MapHealthChecksUI(opt =>
{
    opt.UIPath = "/healthchecks-ui"; 
})
.RequireAuthorization();

});

.NET Core version: 6
Healthchecks version : 7.0.2
Operative system: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    UIquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions