diff --git a/.changelog/13071.txt b/.changelog/13071.txt new file mode 100644 index 0000000000..2493e5875b --- /dev/null +++ b/.changelog/13071.txt @@ -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. +``` diff --git a/agent/ui_endpoint.go b/agent/ui_endpoint.go index c9fb82d086..1a8d5591a6 100644 --- a/agent/ui_endpoint.go +++ b/agent/ui_endpoint.go @@ -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())