proxy: fix bug with incorrect addressing causing invalid route configs

This commit is contained in:
Tejasvi Nareddy 2019-05-21 17:08:03 -04:00
parent 2eb2eb0620
commit 9992eebcac
2 changed files with 3 additions and 3 deletions

View file

@ -325,7 +325,7 @@ func (p *Proxy) Authenticate(w http.ResponseWriter, r *http.Request) (err error)
func (p *Proxy) Handle(host string, handler http.Handler, pol *policy.Policy) { func (p *Proxy) Handle(host string, handler http.Handler, pol *policy.Policy) {
p.routeConfigs[host] = &routeConfig{ p.routeConfigs[host] = &routeConfig{
mux: handler, mux: handler,
policy: pol, policy: *pol,
} }
} }
@ -346,7 +346,7 @@ func (p *Proxy) router(r *http.Request) (http.Handler, bool) {
func (p *Proxy) policy(r *http.Request) (*policy.Policy, bool) { func (p *Proxy) policy(r *http.Request) (*policy.Policy, bool) {
config, ok := p.routeConfigs[r.Host] config, ok := p.routeConfigs[r.Host]
if ok { if ok {
return config.policy, true return &config.policy, true
} }
return nil, false return nil, false
} }

View file

@ -119,7 +119,7 @@ type Proxy struct {
type routeConfig struct { type routeConfig struct {
mux http.Handler mux http.Handler
policy *policy.Policy policy policy.Policy
} }
// New takes a Proxy service from options and a validation function. // New takes a Proxy service from options and a validation function.