From 2ef8905966c38d5b5237aa902fc6f9e2cc04a82a Mon Sep 17 00:00:00 2001 From: Nimi Wariboko Jr Date: Mon, 22 Aug 2016 17:58:43 -0700 Subject: [PATCH] Proxy: Instead of setting DisableKeepAlives, set MaxIdleConnsPerHost to -1 to prevent net/http from pooling the connections. DisableKeepAlives causes net/http to send a Connection: Closed header which is bad. Fixes #1056 --- caddyhttp/proxy/reverseproxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/caddyhttp/proxy/reverseproxy.go b/caddyhttp/proxy/reverseproxy.go index b86b35b2..3c7752bb 100644 --- a/caddyhttp/proxy/reverseproxy.go +++ b/caddyhttp/proxy/reverseproxy.go @@ -304,7 +304,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport { KeepAlive: 30 * time.Second, }).Dial, TLSHandshakeTimeout: 10 * time.Second, - DisableKeepAlives: true, + MaxIdleConnsPerHost: -1, } if base != nil { if baseTransport, ok := base.(*http.Transport); ok { @@ -313,7 +313,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport { transport.TLSHandshakeTimeout = baseTransport.TLSHandshakeTimeout transport.Dial = baseTransport.Dial transport.DialTLS = baseTransport.DialTLS - transport.DisableKeepAlives = true + transport.MaxIdleConnsPerHost = -1 } } hjTransport := &connHijackerTransport{transport, nil, bufferPool.Get().([]byte)[:0]}