X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/741b677dc5e85f60bc03ef130873e49ac0b75766..83974ae9df4060f7aaa6bba61997404a2a7405b2:/lib/controller/proxy.go diff --git a/lib/controller/proxy.go b/lib/controller/proxy.go index d7381860ea..47b8cb4711 100644 --- a/lib/controller/proxy.go +++ b/lib/controller/proxy.go @@ -42,6 +42,9 @@ var dropHeaders = map[string]bool{ "Accept-Encoding": true, "Content-Encoding": true, "Transfer-Encoding": true, + + // Content-Length depends on encoding. + "Content-Length": true, } type ResponseFilter func(*http.Response, error) (*http.Response, error) @@ -60,10 +63,13 @@ func (p *proxy) Do( hdrOut[k] = v } } - xff := reqIn.RemoteAddr - if xffIn := reqIn.Header.Get("X-Forwarded-For"); xffIn != "" { - xff = xffIn + "," + xff + xff := "" + for _, xffIn := range reqIn.Header["X-Forwarded-For"] { + if xffIn != "" { + xff += xffIn + "," + } } + xff += reqIn.RemoteAddr hdrOut.Set("X-Forwarded-For", xff) if hdrOut.Get("X-Forwarded-Proto") == "" { hdrOut.Set("X-Forwarded-Proto", reqIn.URL.Scheme)