From f4cdf53761ff7ea6279122172ae4539153929414 Mon Sep 17 00:00:00 2001 From: Nimi Wariboko Jr Date: Tue, 2 Aug 2016 12:31:17 -0700 Subject: [PATCH] Proxy: Fix transport defn; cleanup connection. --- caddyhttp/proxy/reverseproxy.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/caddyhttp/proxy/reverseproxy.go b/caddyhttp/proxy/reverseproxy.go index 9d7087c24..7feb90076 100644 --- a/caddyhttp/proxy/reverseproxy.go +++ b/caddyhttp/proxy/reverseproxy.go @@ -212,7 +212,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport { KeepAlive: 30 * time.Second, }).Dial, TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + DisableKeepAlives: true, } if base != nil { if baseTransport, ok := base.(*http.Transport); ok { @@ -299,10 +299,9 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request, r if err != nil { return err } - defer backendConn.Close() - outreq.Write(backendConn) } + defer backendConn.Close() go func() { io.Copy(backendConn, conn) // write tcp stream to backend.