From 27e04589c1a0c7ab93f0acf43d77fca88e938673 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 24 Sep 2021 23:32:16 +0200 Subject: [PATCH] outposts/proxyv2: fix routing not working correctly for domain auth Signed-off-by: Jens Langhammer --- internal/outpost/proxyv2/handlers.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/outpost/proxyv2/handlers.go b/internal/outpost/proxyv2/handlers.go index 187aca38c..51b047487 100644 --- a/internal/outpost/proxyv2/handlers.go +++ b/internal/outpost/proxyv2/handlers.go @@ -45,6 +45,15 @@ func (ps *ProxyServer) Handle(rw http.ResponseWriter, r *http.Request) { host := web.GetHost(r) a, ok := ps.apps[host] if !ok { + // If we only have one handler, host name switching doesn't matter + if len(ps.apps) == 1 { + ps.log.WithField("host", host).Warning("passing to single app mux") + for k := range ps.apps { + ps.apps[k].ServeHTTP(rw, r) + return + } + } + ps.log.WithField("host", host).Warning("no app for hostname") rw.WriteHeader(400) return