From e758995458fda54ce102db19e27c662b22c311f1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 7 Feb 2022 19:59:06 +0100 Subject: [PATCH] providers/proxy: improve error handling for invalid backend_override Signed-off-by: Jens Langhammer --- internal/outpost/proxyv2/application/mode_proxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/outpost/proxyv2/application/mode_proxy.go b/internal/outpost/proxyv2/application/mode_proxy.go index db61eeee5..81f0803bd 100644 --- a/internal/outpost/proxyv2/application/mode_proxy.go +++ b/internal/outpost/proxyv2/application/mode_proxy.go @@ -74,16 +74,16 @@ func (a *Application) configureProxy() error { func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) { return func(r *http.Request) { claims, _ := a.getClaims(r) + r.URL.Scheme = ou.Scheme + r.URL.Host = ou.Host if claims.Proxy != nil && claims.Proxy.BackendOverride != "" { u, err := url.Parse(claims.Proxy.BackendOverride) if err != nil { a.log.WithField("backend_override", claims.Proxy.BackendOverride).WithError(err).Warning("failed parse user backend override") + return } r.URL.Scheme = u.Scheme r.URL.Host = u.Host - } else { - r.URL.Scheme = ou.Scheme - r.URL.Host = ou.Host } } }