From 202b057ce996a09802ce24f60993a1b3c536235a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 10 Nov 2021 17:16:13 +0100 Subject: [PATCH] outposts/proxy: fix static files not being served in proxy mode Signed-off-by: Jens Langhammer --- internal/outpost/proxyv2/handlers.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/outpost/proxyv2/handlers.go b/internal/outpost/proxyv2/handlers.go index 51b047487..c7382844d 100644 --- a/internal/outpost/proxyv2/handlers.go +++ b/internal/outpost/proxyv2/handlers.go @@ -2,6 +2,7 @@ package proxyv2 import ( "net/http" + "strings" "time" "github.com/prometheus/client_golang/prometheus" @@ -17,7 +18,7 @@ func (ps *ProxyServer) HandlePing(rw http.ResponseWriter, r *http.Request) { metrics.Requests.With(prometheus.Labels{ "outpost_name": ps.akAPI.Outpost.Name, "method": r.Method, - "schema": r.URL.Scheme, + "scheme": r.URL.Scheme, "path": r.URL.Path, "host": web.GetHost(r), "type": "ping", @@ -33,7 +34,7 @@ func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) { metrics.Requests.With(prometheus.Labels{ "outpost_name": ps.akAPI.Outpost.Name, "method": r.Method, - "schema": r.URL.Scheme, + "scheme": r.URL.Scheme, "path": r.URL.Path, "host": web.GetHost(r), "type": "ping", @@ -42,6 +43,10 @@ func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) { } func (ps *ProxyServer) Handle(rw http.ResponseWriter, r *http.Request) { + if strings.HasPrefix(r.URL.Path, "/akprox/static") { + ps.HandleStatic(rw, r) + return + } host := web.GetHost(r) a, ok := ps.apps[host] if !ok {