From 4d396b89cb3d346ebe94fb1f20472983a70bb180 Mon Sep 17 00:00:00 2001 From: Bhautik Date: Mon, 12 Jan 2026 10:46:32 +0530 Subject: [PATCH] fix: redirect loop for slash --- oryx/httprouterx/router.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oryx/httprouterx/router.go b/oryx/httprouterx/router.go index 4d6cd55c68..f23ac0fb99 100644 --- a/oryx/httprouterx/router.go +++ b/oryx/httprouterx/router.go @@ -108,7 +108,10 @@ func (r *router) handle(method string, route string, handler http.Handler) { func (r *router) ServeHTTP(w http.ResponseWriter, req *http.Request) { r.Mux.ServeHTTP(w, req) } func TrimTrailingSlashNegroni(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { - r.URL.Path = strings.TrimSuffix(r.URL.Path, "/") + // Don't trim the root path to avoid redirect loops + if r.URL.Path != "/" { + r.URL.Path = strings.TrimSuffix(r.URL.Path, "/") + } next(rw, r) }