-
Notifications
You must be signed in to change notification settings - Fork 18k
http.Handle("/", ...) effectively hijacks pages from being not found (due to trailing "/" in the "pattern") #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Alternatively or better, perhaps another interface into the Mux system using lower- level regex calls (if that is what is underneath the default Mux "pattern language"). Ex: http.HandleRegex("/$", SomeFunc) Or have it be type specific and just: http.Handle(SomeRegexObject, SomeFunc) |
Owner changed to [email protected]. |
Agree on the workaround being simple; and that regexps can be overkill. However now you've also introduced another "URL matching language" instead of perhaps using one already familiar. I would suggest: http.Handle(string, SomeHandler) to be the exact string only (or if you must the "URL pattern language" which is currently used, though I do think the common case is for exact string) and: http.HandleRegexp(SomeRegexp, SomeHandler) when something else is required. (Apologies for silly suggestion of method overloading, I had not fully read the Go specification to understand that this is not done in Go at the time of the issue being opened.) |
"directory names (ending with "/") become catch-all for any longer paths." I thought it was designed to be like that, so you can easily implement something like: http://traintimes.org.uk/london/cambridge |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by montsamu:
The text was updated successfully, but these errors were encountered: