Commit 6352c905 authored by Leonard Hecker's avatar Leonard Hecker

Fixed proxy not respecting the -http2 flag

parent e641d2fd
...@@ -148,7 +148,9 @@ func NewSingleHostReverseProxy(target *url.URL, without string, keepalive int) * ...@@ -148,7 +148,9 @@ func NewSingleHostReverseProxy(target *url.URL, without string, keepalive int) *
} else { } else {
transport.MaxIdleConnsPerHost = keepalive transport.MaxIdleConnsPerHost = keepalive
} }
http2.ConfigureTransport(transport) if httpserver.HTTP2 {
http2.ConfigureTransport(transport)
}
rp.Transport = transport rp.Transport = transport
} }
return rp return rp
...@@ -168,10 +170,15 @@ func (rp *ReverseProxy) UseInsecureTransport() { ...@@ -168,10 +170,15 @@ func (rp *ReverseProxy) UseInsecureTransport() {
TLSHandshakeTimeout: 10 * time.Second, TLSHandshakeTimeout: 10 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
} }
http2.ConfigureTransport(transport) if httpserver.HTTP2 {
http2.ConfigureTransport(transport)
}
rp.Transport = transport rp.Transport = transport
} else if transport, ok := rp.Transport.(*http.Transport); ok { } else if transport, ok := rp.Transport.(*http.Transport); ok {
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
// No http2.ConfigureTransport() here.
// For now this is only added in places where
// an http.Transport is actually created.
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment