News for hackers. Stuff that matters.
Re:The HTTP status code for a web server's default “hello” f... by userbinator on Sunday July 09, 2023 @02:31AM (#36652150)
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.

Re:The HTTP status code for a web server's default “hello” f... by pnpnp on Sunday July 09, 2023 @02:41AM (#36652194)
You’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.
Re:The HTTP status code for a web server's default “hello” f... by thunderbong on Sunday July 09, 2023 @02:37AM (#36652175)
That's one thing I keep reminding myself -

No code is faster than no code

Re:The HTTP status code for a web server's default “hello” f... by Chaosvex on Sunday July 09, 2023 @03:25AM (#36652407)
Agreed. 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.
Re:The HTTP status code for a web server's default “hello” f... by vbezhenar on Sunday July 09, 2023 @02:49AM (#36652239)
It 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.
Re:The HTTP status code for a web server's default “hello” f... by mojuba on Sunday July 09, 2023 @03:14AM (#36652352)
That, and "Coming soon" shouldn't be remembered either. So why not have a e.g.

    205 Temporary Placeholder
or something along those lines?
Re:The HTTP status code for a web server's default “hello” f... by NoZebra120vClip on Sunday July 09, 2023 @04:27AM (#36652694)
Ironically, 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!
Re:The HTTP status code for a web server's default “hello” f... by randomdata on Sunday July 09, 2023 @12:24PM (#36655842)
Is that ultimately not the same as 404 – The resource you requested was not found, so here is a temporary placeholder?
Re:The HTTP status code for a web server's default “hello” f... by panzi on Sunday July 09, 2023 @12:53PM (#36656135)
Browsers, 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.
Re:The HTTP status code for a web server's default “hello” f... by eli on Sunday July 09, 2023 @01:25PM (#36656512)
404 is the temporary code. 410 is permanent.
Re:The HTTP status code for a web server's default “hello” f... by pixl97 on Sunday July 09, 2023 @02:05PM (#36657090)
Have you ever seen a 410 actually used IRL? This has to be one of those that's pretty high up in the code rarity list.
Re:The HTTP status code for a web server's default “hello” f... by torgard on Sunday July 09, 2023 @04:40PM (#36658639)
I've used it for resources that have been permanently deleted, rather than the 404 that you'll usually see. I think it makes sense for that sort of stuff.

From a user perspective, getting a 404 after following a link that previously worked can indicate a couple of things. Like maybe the resource still exists in some other place, but they didn't set up redirects. Maybe it's been "privated" in some way, and I no longer have access to it.

A 410 makes it explicitly clear to me, that the resource has been permanently deleted. It'd also be nice if the response included some metadata as to when the resource was deleted.

Re:The HTTP status code for a web server's default “hello” f... by Chaosvex on Sunday July 09, 2023 @03:10AM (#36652332)
Definitely overcomplicating things there. robots.txt already exists.
Re:The HTTP status code for a web server's default “hello” f... by hughesjj on Sunday July 09, 2023 @04:26AM (#36652690)
If they haven't set up their landing page I doubt they configured a robots.txt
Re:The HTTP status code for a web server's default “hello” f... by Chaosvex on Sunday July 09, 2023 @08:10AM (#36653805)
This is clearly talking about default behaviours, so it'd already be there as standard. It's no different than expecting a different status code for the purpose of requesting crawlers not to index.
Re:The HTTP status code for a web server's default “hello” f... by weird-eye-issue on Sunday July 09, 2023 @11:21AM (#36655202)
robots.txt deindexing a site by default is not necessarily the right choice. Lots of people are clueless about it and would never even think to change it when going live.
Re:The HTTP status code for a web server's default “hello” f... by cramjabsyn on Sunday July 09, 2023 @05:38AM (#36653038)
A failback placeholder is a 404…

5xx is a failure to serve the page, which is not the case if a placeholder is served

Re:The HTTP status code for a web server's default “hello” f... by vbezhenar on Sunday July 09, 2023 @01:31PM (#36656605)
I fail to see the difference.

5xx still returns content. 5xx can return HTML content. Browser will display it properly.

4xx codes mean client error. 5xx codes mean server error. Server misconfiguration is a server error. Client did nothing wrong.

Re:The HTTP status code for a web server's default “hello” f... by paulddraper on Sunday July 09, 2023 @02:31PM (#36657425)
The server has been configured without content.
Re:The HTTP status code for a web server's default “hello” f... by h1fra on Sunday July 09, 2023 @12:46PM (#36656060)
It is still a 404.

You can serve a body with a 404, user will see the appropriate message and robot can safely ignore this page until further notice. Search engine will often retry 404 later and slowly reduce crawling if it stays not found.

Re:The HTTP status code for a web server's default “hello” f... by pjerem on Sunday July 09, 2023 @06:42AM (#36653344)
otoh, 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.

Re:The HTTP status code for a web server's default “hello” f... by raldi on Sunday July 09, 2023 @11:32AM (#36655302)
The default should be a 404. The overwhelming majority of such pageviews are mistakes.