Requests are proxied to the Host specified by the target.

This commit is contained in:
John Boxall 2014-11-30 17:13:45 -08:00 committed by Jehiah Czebotar
parent 20a152261c
commit 24ef555547

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 {