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: undocumented ServeFile index.html redirect behavior #9876
After an hour of head scratching and cursing and found that there's a strange way how ServeFile handles any path's that end with
This is not mentioned in the documentation and could cause undesirable behavior.
I tried to add the note about it to the documentation but got rejected because apparently Go doesn't use Github's pull request system. So I don't know how to get this into the documentation so that others won't get tripped over it.
I would actually propose that "feature" to be removed because it's based on an arbitrary of considering the trailing slash ("/") to be the equivalent of a reference to "index.html".
Docs to contribute a patch for review are at: https://golang.org/doc/contribute.html
We should just document it so we're not changing behavior. IIRC, @rsc likes (and implemented) the current behavior. I don't have much preference either way, except for I prefer things not to change. Documenting it is fine.