caddyhttp: Avoid nil pointer dereference in proxyWrapper (#7521)

This commit is contained in:
Fardjad Davari
2026-02-25 10:08:41 +01:00
committed by GitHub
parent 9873752978
commit 9798f6964d

View File

@@ -384,6 +384,9 @@ func (h *HTTPTransport) NewTransport(caddyCtx caddy.Context) (*http.Transport, e
}
// we need to keep track if a proxy is used for a request
proxyWrapper := func(req *http.Request) (*url.URL, error) {
if proxy == nil {
return nil, nil
}
u, err := proxy(req)
if u == nil || err != nil {
return u, err