0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Fixed proxy not respecting the -http2 flag

This commit is contained in:
Leonard Hecker 2016-12-26 20:40:44 +01:00
parent e641d2fd65
commit 6352c9054a

View file

@ -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() {
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.
} }
} }