cmd/containerboot: preserve headers of metrics endpoints responses (#14204)

Updates tailscale/tailscale#11292

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina 2024-11-23 08:51:40 +00:00 committed by GitHub
parent f6431185b0
commit ba3523fc3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}