From 9992eebcacfff839d30cac015ccd70078bedc15b Mon Sep 17 00:00:00 2001 From: Tejasvi Nareddy Date: Tue, 21 May 2019 17:08:03 -0400 Subject: [PATCH] proxy: fix bug with incorrect addressing causing invalid route configs --- proxy/handlers.go | 4 ++-- proxy/proxy.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/handlers.go b/proxy/handlers.go index 9f095ad3a..c1a4a4ec5 100644 --- a/proxy/handlers.go +++ b/proxy/handlers.go @@ -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) { p.routeConfigs[host] = &routeConfig{ 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) { config, ok := p.routeConfigs[r.Host] if ok { - return config.policy, true + return &config.policy, true } return nil, false } diff --git a/proxy/proxy.go b/proxy/proxy.go index 83729116e..7d8b74af9 100755 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -119,7 +119,7 @@ type Proxy struct { type routeConfig struct { mux http.Handler - policy *policy.Policy + policy policy.Policy } // New takes a Proxy service from options and a validation function.