Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: ServeMux unexpectedly redirecting to add trailing slash #11757
Given the following
http.HandleFunc("/", ...) http.HandleFunc("/a/", ...)
Instead, a 301 redirect is returned redirecting to
The docs describe redirects as happening in path sanitization cases (ie: requests with
In researching if this situation was reported before, I found a mailing list from 2010 implying this was expected as well as a code comment. If that is still the case, then i think the docs should reflect that. (though i personally consider this a bug, i could understand that for some this could be a feature).
For context I've looked at how this is handled by other http routers. It's mixed as to how default implementations behave, but generally is documented clearly with a configurable.