Requests are proxied to the Host specified by the target.
commit24ef5555479802a9cebda04433dd7955562c4e23
authorJohn Boxall <john@mobify.com>
dateSun 30 Nov 2014, 17:13 (12 years ago)
parent20a1522
oauthproxy.go+7−1
@@ -47,7 +47,13 @@ type OauthProxy struct {
4747}
4848
4949func NewReverseProxy(target *url.URL) (proxy *httputil.ReverseProxy) {
50− return httputil.NewSingleHostReverseProxy(target)
50+ proxy = httputil.NewSingleHostReverseProxy(target)
51+ director := proxy.Director
52+ proxy.Director = func(req *http.Request) {
53+ director(req)
54+ req.Host = target.Host
55+ }
56+ return proxy
5157}
5258
5359func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {