mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
Metrics: Fix internal metrics endpoint not accessible from browser if basic auth is enabled (#86904)
* add WWW-Authenticate header in the http response of /metrics endpoint in case of wrong basic auth credentials Signed-off-by: Syed Nihal <syed.nihal@nokia.com> * added change log for the change fixing the issue https://github.com/grafana/grafana/issues/86902 Signed-off-by: Syed Nihal <syed.nihal@nokia.com> * Update CHANGELOG.md --------- Signed-off-by: Syed Nihal <syed.nihal@nokia.com>
This commit is contained in:
parent
420ff1d07b
commit
c1d9e793be
@ -656,6 +656,7 @@ func (hs *HTTPServer) metricsEndpoint(ctx *web.Context) {
|
||||
}
|
||||
|
||||
if hs.metricsEndpointBasicAuthEnabled() && !BasicAuthenticatedRequest(ctx.Req, hs.Cfg.MetricsEndpointBasicAuthUsername, hs.Cfg.MetricsEndpointBasicAuthPassword) {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Grafana"`)
|
||||
ctx.Resp.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user