mirror of
https://github.com/fosrl/newt.git
synced 2026-05-20 15:19:52 +00:00
Fix transport issue
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user