mirror of
https://github.com/status-im/consul.git
synced 2025-01-21 19:20:41 +00:00
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
9168da8bb3
commit
a0455774c0
3
.changelog/13071.txt
Normal file
3
.changelog/13071.txt
Normal file
@ -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,7 +740,11 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques
|
||||
|
||||
// Add any configured headers
|
||||
for _, h := range cfg.AddHeaders {
|
||||
req.Header.Set(h.Name, h.Value)
|
||||
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…
x
Reference in New Issue
Block a user