When a host header is defined override `req.Host` in the metrics ui (#13071)
* When a host header is defined override the req.Host in the metrics ui endpoint. * add changelog
This commit is contained in:
parent
d33d06e033
commit
70b93ea693
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
Fix a bug when configuring an `add_headers` directive named `Host` the header is not set for `v1/internal/ui/metrics-proxy/` endpoint.
|
||||
```
|
|
@ -740,8 +740,12 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques
|
|||
|
||||
// Add any configured headers
|
||||
for _, h := range cfg.AddHeaders {
|
||||
if strings.ToLower(h.Name) == "host" {
|
||||
req.Host = h.Value
|
||||
} else {
|
||||
req.Header.Set(h.Name, h.Value)
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("proxying request", "to", u.String())
|
||||
|
||||
|
|
Loading…
Reference in New Issue