> How are you implementing SPAs in a way that you can't return a 404?
Not specifically me, but a lot of SPAs have their own routing.
So you would go to
https://my-spa.com/user/39820002/post/39811155
When you hit that route, the webserver returns /index.html with the JS bundle, the JS runs and matches the user ID and post ID from the URL and then maybe makes some API requests to fetch content of whatever, I mean the SPA doesn't have to be backed by an API anyways, could be purely static but still use a router.
In the React world, react-router is (was) pretty popular:
https://github.com/remix-run/react-router
That's a library that works exactly that way, relying on every route being passed to the JS bundle for handling, so the webserver needs to be configured to never return 404 and just return the index.html for every route, here is an example of what this looks like from the docs of Caddy, another popular webserver with a pretty easy to understand config format:
https://caddyserver.com/docs/caddyfile/patterns#single-page-...
It's a "Single Page App", you may have many pages being rendered by this app, but it's a single html page that is responsible for doing this.
Now – SPAs are not as popular as they used to be, and there is an argument to be made that they aren't the best solution in most cases with what's available now, regardless of that they do exist and this appears to be a web server specifically for them so having the option handle SPA routing as it's commonly done, does make sense.
And I think for stuff like internal management apps, admin panels etc. SPAs with their own routing are still a decent solution.