From ba3523fc3f62835bcddba683e37257ed7d53493c Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Sat, 23 Nov 2024 08:51:40 +0000 Subject: [PATCH] cmd/containerboot: preserve headers of metrics endpoints responses (#14204) Updates tailscale/tailscale#11292 Signed-off-by: Irbe Krumina --- cmd/containerboot/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/containerboot/metrics.go b/cmd/containerboot/metrics.go index e88406f97..874774d7a 100644 --- a/cmd/containerboot/metrics.go +++ b/cmd/containerboot/metrics.go @@ -38,12 +38,12 @@ func proxy(w http.ResponseWriter, r *http.Request, url string, do func(*http.Req } defer resp.Body.Close() - w.WriteHeader(resp.StatusCode) for key, val := range resp.Header { for _, v := range val { w.Header().Add(key, v) } } + w.WriteHeader(resp.StatusCode) if _, err := io.Copy(w, resp.Body); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) }