Requests are proxied to the Host specified by the target.
This commit is contained in:
parent
20a152261c
commit
24ef555547
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user