Fix transport issue

This commit is contained in:
Owen
2026-04-22 21:36:16 -07:00
parent 294f99e024
commit bfd61ca511

View File

@@ -276,10 +276,10 @@ func (h *HTTPHandler) getProxy(target HTTPTarget) *httputil.ReverseProxy {
Scheme: scheme, Scheme: scheme,
Host: fmt.Sprintf("%s:%d", target.DestAddr, target.DestPort), Host: fmt.Sprintf("%s:%d", target.DestAddr, target.DestPort),
} }
insecureTransport := (*http.Transport)(nil) var transport http.RoundTripper = http.DefaultTransport
if target.Scheme == "https" { if target.Scheme == "https" {
// Allow self-signed certificates on downstream HTTPS targets. // Allow self-signed certificates on downstream HTTPS targets.
insecureTransport = &http.Transport{ transport = &http.Transport{
TLSClientConfig: &tls.Config{ TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, //nolint:gosec // downstream self-signed certs are a supported configuration InsecureSkipVerify: true, //nolint:gosec // downstream self-signed certs are a supported configuration
}, },
@@ -296,7 +296,7 @@ func (h *HTTPHandler) getProxy(target HTTPTarget) *httputil.ReverseProxy {
// X-Forwarded-For entry, so the header is set exactly once. // X-Forwarded-For entry, so the header is set exactly once.
pr.SetXForwarded() pr.SetXForwarded()
}, },
Transport: insecureTransport, Transport: transport,
} }
proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) {