Merge pull request #133 from nareddyt/bug-route-config-addresses

proxy: fix bug with incorrect addressing causing invalid route configs
This commit is contained in:
Bobby DeSimone 2019-05-21 16:30:21 -07:00 committed by GitHub
commit c53c07c274
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -298,7 +298,7 @@ func (p *Proxy) authenticate(w http.ResponseWriter, r *http.Request, session *se
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,
} }
} }
@ -319,7 +319,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.