diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2015-10-08 13:37:39 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2015-10-08 23:15:40 +0000 |
| commit | ae315999c2d5514cec17adbd37cf2438e20cbd12 (patch) | |
| tree | 884e399d802ff520c3c064bb4a89d78aec068d3a /src/net/http/httputil/reverseproxy.go | |
| parent | b795ce9ab0cce86f9f76904a9f933b11ac993c8a (diff) | |
| download | go-ae315999c2d5514cec17adbd37cf2438e20cbd12.tar.xz | |
net/http/httputil: clarify NewSingleHostReverseProxy's Host header behavior
Fixes #10342
Change-Id: I69c69352016a8fd0b62541128c2e86b242ebbe26
Reviewed-on: https://go-review.googlesource.com/15630
Reviewed-by: Minux Ma <minux@golang.org>
Diffstat (limited to 'src/net/http/httputil/reverseproxy.go')
| -rw-r--r-- | src/net/http/httputil/reverseproxy.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index c8e113221c..95a99ddb9d 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -60,10 +60,13 @@ func singleJoiningSlash(a, b string) string { return a + b } -// NewSingleHostReverseProxy returns a new ReverseProxy that rewrites +// NewSingleHostReverseProxy returns a new ReverseProxy that routes // URLs to the scheme, host, and base path provided in target. If the // target's path is "/base" and the incoming request was for "/dir", // the target request will be for /base/dir. +// NewSingleHostReverseProxy does not rewrite the Host header. +// To rewrite Host headers, use ReverseProxy directly with a custom +// Director policy. func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy { targetQuery := target.RawQuery director := func(req *http.Request) { |
