You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-15 00:15:00 +02:00
Adds failing test for using upstream Host header.
This commit is contained in:
committed by
Jehiah Czebotar
parent
ade9502dd2
commit
20a152261c
@ -46,6 +46,10 @@ type OauthProxy struct {
|
||||
compiledRegex []*regexp.Regexp
|
||||
}
|
||||
|
||||
func NewReverseProxy(target *url.URL) (proxy *httputil.ReverseProxy) {
|
||||
return httputil.NewSingleHostReverseProxy(target)
|
||||
}
|
||||
|
||||
func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
|
||||
login, _ := url.Parse("https://accounts.google.com/o/oauth2/auth")
|
||||
redeem, _ := url.Parse("https://accounts.google.com/o/oauth2/token")
|
||||
@ -54,7 +58,7 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
|
||||
path := u.Path
|
||||
u.Path = ""
|
||||
log.Printf("mapping path %q => upstream %q", path, u)
|
||||
serveMux.Handle(path, httputil.NewSingleHostReverseProxy(u))
|
||||
serveMux.Handle(path, NewReverseProxy(u))
|
||||
}
|
||||
for _, u := range opts.CompiledRegex {
|
||||
log.Printf("compiled skip-auth-regex => %q", u)
|
||||
|
Reference in New Issue
Block a user