Skip to content

Commit 9798f69

Browse files
authored
caddyhttp: Avoid nil pointer dereference in proxyWrapper (#7521)
1 parent 9873752 commit 9798f69

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/caddyhttp/reverseproxy/httptransport.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ func (h *HTTPTransport) NewTransport(caddyCtx caddy.Context) (*http.Transport, e
384384
}
385385
// we need to keep track if a proxy is used for a request
386386
proxyWrapper := func(req *http.Request) (*url.URL, error) {
387+
if proxy == nil {
388+
return nil, nil
389+
}
387390
u, err := proxy(req)
388391
if u == nil || err != nil {
389392
return u, err

0 commit comments

Comments
 (0)