diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2018-05-29 22:08:32 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-05-29 22:33:14 +0000 |
commit | 9e56156ade484d806cdd3aceb38f100b66d490bf (patch) | |
tree | 99dfd891846e2b4949ca04f608b4537ff1ee234f /src/net/http/httputil/reverseproxy.go | |
parent | 6c6e22e5a9b70f22750e4fc210cd67175c6d1187 (diff) | |
download | go-9e56156ade484d806cdd3aceb38f100b66d490bf.tar.gz go-9e56156ade484d806cdd3aceb38f100b66d490bf.zip |
net/http/httputil: pass through any "TE: trailers" header to backend
Fixes #21096
Change-Id: I2a4688a79bdaa25b4e8ef38e3390d93d3d0bce04
Reviewed-on: https://go-review.googlesource.com/115135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/http/httputil/reverseproxy.go')
-rw-r--r-- | src/net/http/httputil/reverseproxy.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index 80ee22895a..d5d0a505f7 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -178,9 +178,20 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { // important is "Connection" because we want a persistent // connection, regardless of what the client sent to us. for _, h := range hopHeaders { - if outreq.Header.Get(h) != "" { - outreq.Header.Del(h) + hv := outreq.Header.Get(h) + if hv == "" { + continue } + if h == "Te" && hv == "trailers" { + // Issue 21096: tell backend applications that + // care about trailer support that we support + // trailers. (We do, but we don't go out of + // our way to advertise that unless the + // incoming client request thought it was + // worth mentioning) + continue + } + outreq.Header.Del(h) } if clientIP, _, err := net.SplitHostPort(req.RemoteAddr); err == nil { |