mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-31 09:57:17 +02:00
httputil/reproxy: fix policy transport (#3322)
This commit is contained in:
parent
a2d2f34e24
commit
6b663ba53f
2 changed files with 9 additions and 0 deletions
|
@ -62,6 +62,7 @@ func NewPolicyHTTPTransport(options *Options, policy *Policy, disableHTTP2 bool)
|
|||
//
|
||||
if disableHTTP2 {
|
||||
transport.TLSNextProto = map[string]func(authority string, c *tls.Conn) http.RoundTripper{}
|
||||
transport.ForceAttemptHTTP2 = false
|
||||
}
|
||||
|
||||
var tlsClientConfig tls.Config
|
||||
|
@ -111,6 +112,7 @@ func NewPolicyHTTPTransport(options *Options, policy *Policy, disableHTTP2 bool)
|
|||
// We avoid setting a custom client config unless we have to as
|
||||
// if TLSClientConfig is nil, the default configuration is used.
|
||||
if isCustomClientConfig {
|
||||
transport.DialTLSContext = nil
|
||||
transport.TLSClientConfig = &tlsClientConfig
|
||||
}
|
||||
return c.Then(transport)
|
||||
|
|
|
@ -37,6 +37,13 @@ func TestHTTPTransport(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPolicyHTTPTransport(t *testing.T) {
|
||||
originalTransport := http.DefaultTransport
|
||||
defer func() {
|
||||
http.DefaultTransport = originalTransport
|
||||
}()
|
||||
src := NewStaticSource(&Config{Options: &Options{}})
|
||||
http.DefaultTransport = NewHTTPTransport(src)
|
||||
|
||||
s := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue