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: Custom Error handlers #10123
For example, if you want custom error pages (including 404 not found pages) and want to serve files you need to bypass the built in file server and re-implement much of it to change the error page handling.
It would be far simpler to allow the
It's hard to get excited about this.
Something like this?
Seems a bit gross TBH. I don't know that we want to add yet another hook.
@bradfitz that's an interesting take I had not thought of. It should work.
My issue with it is that it's not a good separation of concerns. It's a hack to work around this limitation. Something that's responsible with content now needs to look for certain types of responses and override the output to something custom.
It would be nice to have a clean solution.