diff --git a/caddyhttp/proxy/reverseproxy.go b/caddyhttp/proxy/reverseproxy.go index 5fc4aed9..08bfdd56 100644 --- a/caddyhttp/proxy/reverseproxy.go +++ b/caddyhttp/proxy/reverseproxy.go @@ -413,8 +413,12 @@ func copyHeader(dst, src http.Header) { if _, shouldSkip := skipHeaders[k]; shouldSkip { continue } - // otherwise, overwrite - dst.Del(k) + // otherwise, overwrite to avoid duplicated fields that can be + // problematic (see issue #1086) -- however, allow duplicate + // Server fields so we can see the reality of the proxying. + if k != "Server" { + dst.Del(k) + } } for _, v := range vv { dst.Add(k, v)