mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
reverseproxy: Disable keep alive for h2c requests (#6343)
This commit is contained in:
parent
52bad45181
commit
21af88fefc
1 changed files with 3 additions and 0 deletions
|
@ -446,6 +446,9 @@ func (h *HTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
// if H2C ("HTTP/2 over cleartext") is enabled and the upstream request is
|
// if H2C ("HTTP/2 over cleartext") is enabled and the upstream request is
|
||||||
// HTTP without TLS, use the alternate H2C-capable transport instead
|
// HTTP without TLS, use the alternate H2C-capable transport instead
|
||||||
if req.URL.Scheme == "http" && h.h2cTransport != nil {
|
if req.URL.Scheme == "http" && h.h2cTransport != nil {
|
||||||
|
// There is no dedicated DisableKeepAlives field in *http2.Transport.
|
||||||
|
// This is an alternative way to disable keep-alive.
|
||||||
|
req.Close = h.Transport.DisableKeepAlives
|
||||||
return h.h2cTransport.RoundTrip(req)
|
return h.h2cTransport.RoundTrip(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue