From 38eb7fb21bacd4688e577b8f476128743105213b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 5 Dec 2025 14:16:29 +0100 Subject: [PATCH] use clean urls for routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- services/proxy/pkg/router/router.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/proxy/pkg/router/router.go b/services/proxy/pkg/router/router.go index 36096e3962..cdf93b7790 100644 --- a/services/proxy/pkg/router/router.go +++ b/services/proxy/pkg/router/router.go @@ -5,6 +5,7 @@ import ( "net/http" "net/http/httputil" "net/url" + "path" "regexp" "strings" @@ -271,7 +272,7 @@ func (rt Router) regexRouteMatcher(pattern string, target url.URL) bool { } func prefixRouteMatcher(prefix string, target url.URL) bool { - return strings.HasPrefix(target.Path, prefix) && prefix != "/" + return strings.HasPrefix(path.Clean(target.Path), prefix) && prefix != "/" } func singleJoiningSlash(a, b string) string { @@ -288,7 +289,7 @@ func singleJoiningSlash(a, b string) string { func queryRouteMatcher(endpoint string, target url.URL) bool { u, _ := url.Parse(endpoint) - if !strings.HasPrefix(target.Path, u.Path) || endpoint == "/" { + if !strings.HasPrefix(path.Clean(target.Path), u.Path) || endpoint == "/" { return false } q := u.Query()