Of course you might still consider that a bug or wrong, but it's reality for a lot of web pages.
And I don't see the need to use a SPA almost anywhere. If you are gonna use a SPA for stuff that really doesn't require it, I think it behooves you to still atleast try to conform the the HTTP spec
Did I advocate for that in any way?
> If you are gonna use a SPA for stuff that really doesn't require it, I think it behooves you to still atleast try to conform the the HTTP spec
Why? Give me a good reason why it's worth the effort for small tools I write.
Why are you using SPAs with internal routing for small tools?
An SPA only needs to use urls to represent states that should be externally reachable. If you want those states to be externally reachable, then you probably want those states to be indexable by search engines. You also want users to know if a url is mistyped/miscopied and a 404 response page does a good job of that.
In the end, given the spec, it is on you to carefully consider amd have a good reason to go against the recommendations.
Because I don't use a server if I can help it. Client-side routing is wonderfully easy to use and provides a great user experience. What good does it for me to pre-render the sites or host it on a server where I can route server-side if client-side routing works perfectly for what I write?
> An SPA only needs to use urls to represent states that should be externally reachable.
"Needs" does a lot here. My tools integrate with browser history for navigation, so I need URLs for that as well. But I often make state available in the query, so it's externally reachable.
> If you want those states to be externally reachable, then you probably want those states to be indexable by search engines.
No.
> You also want users to know if a url is mistyped/miscopied and a 404 response page does a good job of that.
I do, and client-side routing gives users a wonderful 404 page. No need for serving a status 404.
> In the end, given the spec, it is on you to carefully consider amd have a good reason to go against the recommendations.
I've given good reasons. You haven't so far.
SPA is ironically not needed mostly on single-page sites. When I see comments like this it sincerely puzzles me what your common user stories are and/or how you managed to train a blind eye to all this.
A vulnerability scanner having to implement hairy heuristics to decide what's a vuln and what's a common false positive is literally its whole job.
It's silly to pretend that the use of a 404 in this type of circumstance is either clearcut in the standards or ubiquitous in practice.
The standards seem pretty clear to me.
I would point out that technically, the path portion of the HN URI does indeed point to a valid endpoint, it is the query portion of the URI (usually not used by the server to do any routing) that points to a non-existent resource.
Still, HN is wrong here and should be returning a 404 status.
To be fair, it's not about some rando on a blog post. The HTTP response codes and their semantics are in the RFCs. And while it's true the RFCs say SHOULD and not MUST, there are also now ~30 decades of experience and expectation that a non-existent resource is more likely a 404 not 200.
Sure a server can always do what it likes but can't expect it to play well with the outside world if it goes against both convention and documentation.
> Neither party is exactly wrong here, but the result is not ideal.
No, Prometheus has a bug if this is the case, and cks says it himself further on...
> all it would need to do is only give a HTTP 200 response for '/' and then a 404 (with the same HTML) for everything else that it answers with the generic front page