node-ecstatic
node-ecstatic copied to clipboard
Use 200.html as a fallback before 404.html
This is a convention I think makes a lot of sense for single page applications, when a URL doesn't match anything.
- First check for
/200.html
and serve that with status404
- Then check for
/404.html
and serve that with status404
- Then serve a blank
404
This was introduced by harp (I think) and is used by surge.sh and it seems to be really straightforward to use.
I've made it so that if you set the config of handleError
to false
then this doesn't look for 200.html
either, just to keep compatibility with other clients.
Hey, just now seeing this. Will try to review in the next few days.
So, uh, yeah! Github's new review feature is okay.
Last thought: Is this testable?
I lied:
Do you think this PR solves a similar problem as https://github.com/jfhbrook/node-ecstatic/pull/146 ?
@jfhbrook it solves similar problem for me in a less flexible way.
In my case, I'd love to be able to give custom fallback page, and not rely on convention 200/404.html pages
I wouldn't have expected any special 200/404 file behaviour either, as the README doesn't mention it.
Feel free to PR some clarifying docs @mk-pmb