mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-16 07:46:28 +03:00
reverseproxy: always set req.URL.Host with upstream (#3297)
This commit is contained in:
parent
e3a8f72f1c
commit
da8686c4b9
1 changed files with 9 additions and 11 deletions
|
@ -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
|
||||||
|
|
||||||
|
@ -626,7 +625,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
|
||||||
// panic with http.ErrAbortHandler. This is the right thing to do by
|
// panic with http.ErrAbortHandler. This is the right thing to do by
|
||||||
|
|
Loading…
Reference in a new issue