From 24ef5555479802a9cebda04433dd7955562c4e23 Mon Sep 17 00:00:00 2001 From: John Boxall Date: Sun, 30 Nov 2014 17:13:45 -0800 Subject: [PATCH] Requests are proxied to the Host specified by the target. --- oauthproxy.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/oauthproxy.go b/oauthproxy.go index 16c0dad..0705b6d 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -47,7 +47,13 @@ type OauthProxy struct { } 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 {