@@ -142,13 +142,13 @@ func (ctx *DevProxy) getProxyUrlForRequest(req *http.Request) (*url.URL, *tls.Co
142142 }
143143 if req .URL .Scheme == "https" {
144144 if ctx .Config .Proxy .HTTPSProxy != nil {
145- return ctx .Config .Proxy .HTTPSProxy , & ctx .Config .Proxy .TLSConfig , nil
145+ return ctx .Config .Proxy .HTTPSProxy , ctx .Config .Proxy .TLSConfig , nil
146146 }
147147 }
148148 // falls back to http
149149 if req .URL .Scheme == "https" || req .URL .Scheme == "http" {
150150 if ctx .Config .Proxy .HTTPProxy != nil {
151- return ctx .Config .Proxy .HTTPProxy , & ctx .Config .Proxy .TLSConfig , nil
151+ return ctx .Config .Proxy .HTTPProxy , ctx .Config .Proxy .TLSConfig , nil
152152 }
153153 }
154154 return nil , nil , nil
@@ -160,14 +160,17 @@ func (ctx *DevProxy) newTLSConfigFactory() TLSConfigFactory {
160160 }
161161 return func (hostPortPairStr string , proxyCtx * OurProxyCtx ) (* tls.Config , error ) {
162162 pair := splitHostPort (hostPortPairStr )
163- config := ctx .Config .MITM .ServerTLSConfigTemplate
163+ if ctx .Config .MITM .ServerTLSConfigTemplate == nil {
164+ return nil , errors .Errorf ("no TLS configuration template is available" )
165+ }
166+ config := ctx .Config .MITM .ServerTLSConfigTemplate .Clone ()
164167 ctx .Logger .Infof ("Obtaining temporary certificate for %s" , pair .Host )
165168 cert , err := ctx .prepareMITMCertificate ([]string {pair .Host })
166169 if err != nil {
167170 return nil , errors .Wrapf (err , "cannot sign host certificate with provided CA" )
168171 }
169172 config .Certificates = append (config .Certificates , * cert )
170- return & config , nil
173+ return config , nil
171174 }
172175}
173176
@@ -179,7 +182,7 @@ func (ctx *DevProxy) newProxyURLBuilder() func(*http.Request) (*url.URL, *tls.Co
179182
180183func (ctx * DevProxy ) newHttpTransport () * httpx.Transport {
181184 transport := & httpx.Transport {
182- TLSClientConfig : & ctx .Config .MITM .ClientTLSConfigTemplate ,
185+ TLSClientConfig : ctx .Config .MITM .ClientTLSConfigTemplate ,
183186 Proxy2 : ctx .newProxyURLBuilder (),
184187 }
185188 transport .RegisterProtocol ("fastcgi" , & fastCGIRoundTripper {Logger : ctx .Logger })
0 commit comments