git.iko.soy/typeable/oauth2-proxy
on master help sign in
Requests are proxied to the Host specified by the target.
24ef555John Boxall
oauthproxy.go+7−1
@@ -47,7 +47,13 @@ type OauthProxy struct {
47}
47}
48
48
49func NewReverseProxy(target *url.URL) (proxy *httputil.ReverseProxy) {
49func 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
51}
57}
52
58
53func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
59func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {