4 ms·
If this is talking about a "placeholder" index.htm that comes with the server, I think the answer is obvious: If you request that page, it will successfully fin
by userbinator 3y ago
If this is talking about a "placeholder" index.htm that comes with the server, I think the answer is obvious: If you request that page, it will successfully find and serve it in the same way as any other page. Thus 200 is the expected response.
On the other hand, if there's no page to be served, not even a default one, then it should 404. (Unless the default config is to list the (empty) directory, and it exists, in which case 200.)
There's no need to complicate things beyond that. One thing that I've learned over many years of experience with software is that if at all possible you should never add additional conditions or edge-cases, because they will tend to create more problems than they solve. The server is behaving most consistently if it treats the placeholder page the same as any other.
Would you want a compiler that specifically detects "hello world" programs and compiles them to always return failure, under the similar argument that it's not a "real" program? Because that's the logical conclusion of this sort of inane overthinking.
- thunderbong 3y agoThat's one thing I keep reminding myself - No code is faster than no code
- Chaosvex 3y agoAgreed. Anything other than 200 is going to require special case handling by the server. How else would it know whether it's serving up the default index? You could add a .htaccess (or equivalent) rule but that increases the likelihood of somebody forgetting to remove it.
- pnpnp 3y agoYou’re not wrong, but I also believe that a lot of these problems are inherently complicated. Trying to encapsulate all the cases for a given problem will inherently have edge cases. Yes they suck and yes we should try to prevent them when possible, but I feel like ignoring them is also a huge foot-gun.
- vbezhenar 3y agoIt is about fallback placeholder which is not the same as default placeholder, but rather indicates that user did not configure his website at all. I'd say that 5xx is appropriate here. For example you don't want for Google to remember your website as "Apache installed" if its crawler happens to run nearby.
- mojuba 3y agoThat, and "Coming soon" shouldn't be remembered either. So why not have a e.g. 205 Temporary Placeholder or something along those lines?
- NoZebra120vClip 3y agoIronically, I sought to make a reference to the GeoCities "Under Construction" animated GIFs, and upon visiting knowyourmeme.com, they served me a 500 error on their landing page. Justice!
- randomdata 3y agoIs that ultimately not the same as 404 – The resource you requested was not found, so here is a temporary placeholder?
- panzi 3y agoBrowsers, proxies and crawlers might remember 404 longer than any status code that has "temporary" in it. See also the various permanent and temporary redirect status codes.
- pjerem 3y agootoh, if you somehow monitor if your web servers are working, you wouldn’t want your server to answer with 200 in the case the configuration is reset by error. I mean, the real point is here : nobody cares what your server is answering just after being setup. However I can see how it’s a problem if for any reason, a server loses its configuration and still acts like everything is fine. (ofc you can bypass this by monitoring a more specific url but it’s not always possible if you are not the one deciding what the server serves) For your analogy, it’s more like you’d want your compiler to fail if you fed it with no source code.
- raldi 3y agoThe default should be a 404. The overwhelming majority of such pageviews are mistakes.