mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-01 04:34:21 -04:00
reverseproxy: always set req.URL.Host with upstream (#3297)
This commit is contained in:
parent
e3a8f72f1c
commit
da8686c4b9
@ -613,7 +613,6 @@ func (lb LoadBalancing) tryAgain(start time.Time, proxyErr error, req *http.Requ
|
|||||||
// directRequest modifies only req.URL so that it points to the upstream
|
// directRequest modifies only req.URL so that it points to the upstream
|
||||||
// in the given DialInfo. It must modify ONLY the request URL.
|
// in the given DialInfo. It must modify ONLY the request URL.
|
||||||
func (h Handler) directRequest(req *http.Request, di DialInfo) {
|
func (h Handler) directRequest(req *http.Request, di DialInfo) {
|
||||||
if req.URL.Host == "" {
|
|
||||||
// we need a host, so set the upstream's host address
|
// we need a host, so set the upstream's host address
|
||||||
reqHost := di.Address
|
reqHost := di.Address
|
||||||
|
|
||||||
@ -625,7 +624,6 @@ func (h Handler) directRequest(req *http.Request, di DialInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
req.URL.Host = reqHost
|
req.URL.Host = reqHost
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shouldPanicOnCopyError reports whether the reverse proxy should
|
// shouldPanicOnCopyError reports whether the reverse proxy should
|
||||||
|
Loading…
x
Reference in New Issue
Block a user