mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
reverseproxy: Always remove hop-by-hop headers
See golang/go#46313
Based on 950fa11c4c
This commit is contained in:
parent
94b712009a
commit
2a8109468c
1 changed files with 7 additions and 11 deletions
|
@ -504,18 +504,14 @@ func (h Handler) prepareRequest(req *http.Request) error {
|
||||||
// Remove hop-by-hop headers to the backend. Especially
|
// Remove hop-by-hop headers to the backend. Especially
|
||||||
// important is "Connection" because we want a persistent
|
// important is "Connection" because we want a persistent
|
||||||
// connection, regardless of what the client sent to us.
|
// connection, regardless of what the client sent to us.
|
||||||
|
// Issue golang/go#46313: don't skip if field is empty.
|
||||||
for _, h := range hopHeaders {
|
for _, h := range hopHeaders {
|
||||||
hv := req.Header.Get(h)
|
// Issue golang/go#21096: tell backend applications that care about trailer support
|
||||||
if hv == "" {
|
// that we support trailers. (We do, but we don't go out of our way to
|
||||||
continue
|
// advertise that unless the incoming client request thought it was worth
|
||||||
}
|
// mentioning.)
|
||||||
if h == "Te" && hv == "trailers" {
|
if h == "Te" && httpguts.HeaderValuesContainsToken(req.Header["Te"], "trailers") {
|
||||||
// Issue golang/go#21096: tell backend applications that
|
req.Header.Set("Te", "trailers")
|
||||||
// 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
|
continue
|
||||||
}
|
}
|
||||||
req.Header.Del(h)
|
req.Header.Del(h)
|
||||||
|
|
Loading…
Reference in a new issue