Requests are proxied to the Host specified by the target.

This commit is contained in:
John Boxall
2015-03-17 15:04:27 -04:00
committed by Jehiah Czebotar
parent 20a152261c
commit 24ef555547
+7 -1
View File
@@ -47,7 +47,13 @@ type OauthProxy struct {
} }
func NewReverseProxy(target *url.URL) (proxy *httputil.ReverseProxy) { func NewReverseProxy(target *url.URL) (proxy *httputil.ReverseProxy) {
return httputil.NewSingleHostReverseProxy(target) proxy = httputil.NewSingleHostReverseProxy(target)
director := proxy.Director
proxy.Director = func(req *http.Request) {
director(req)
req.Host = target.Host
}
return proxy
} }
func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy { func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {