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()