From 25786e60c68a5ab26a9a2ede2e8c8e920068fef2 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Fri, 13 Sep 2024 20:41:14 -0700 Subject: [PATCH] Fix redirect loop with no prefix on debug endpoints Fixes #680 --- cmd/promxy/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/promxy/main.go b/cmd/promxy/main.go index bd1ba6c2c..2407f2fd7 100644 --- a/cmd/promxy/main.go +++ b/cmd/promxy/main.go @@ -448,7 +448,7 @@ func main() { r.NotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Have our fallback rules if strings.HasPrefix(r.URL.Path, path.Join(webOptions.RoutePrefix, "/debug")) { - http.StripPrefix(webOptions.RoutePrefix, http.DefaultServeMux).ServeHTTP(w, r) + http.StripPrefix(strings.Trim(webOptions.RoutePrefix, "/"), http.DefaultServeMux).ServeHTTP(w, r) } else if r.URL.Path == path.Join(webOptions.RoutePrefix, "/-/ready") { if stopping { w.WriteHeader(http.StatusServiceUnavailable)