Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion oryx/httprouterx/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading