From 76dcf3af677a4dd0686c67d8afc84370b7e6f597 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 10 Feb 2024 23:46:19 +0300 Subject: [PATCH] fixup redirect Signed-off-by: Vasiliy Tolstov --- handler/pprof/pprof.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/pprof/pprof.go b/handler/pprof/pprof.go index eb2f673..636eab1 100644 --- a/handler/pprof/pprof.go +++ b/handler/pprof/pprof.go @@ -15,7 +15,7 @@ func NewHandler(prefixPath string, initFuncs ...func()) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { switch { - case strings.EqualFold(r.RequestURI, prefixPath) && r.RequestURI[len(r.RequestURI)] != '/': + case strings.EqualFold(r.RequestURI, prefixPath) && r.RequestURI[len(r.RequestURI)-1] != '/': http.Redirect(w, r, r.RequestURI+"/", http.StatusMovedPermanently) case strings.HasPrefix(r.RequestURI, path.Join(prefixPath, "cmdline")): pprof.Cmdline(w, r)