4 ms·
If I make a typo and get a 200 for some url that doesn't actually exist, my browser will now happily suggest that url when I'm typing something in the future.
by eddd-ddde 3y ago
If I make a typo and get a 200 for some url that doesn't actually exist, my browser will now happily suggest that url when I'm typing something in the future.
Is there a benefit for doing so?
- shawabawa3 3y agoIt's not a benefit but a side effect of client side routing If your main routing logic is in your JS app your server can't know if a route exists or not unless you duplicate routing code across front end and backend
- antihero 3y agoWell client side routing is fundamentally broken unless you do serve a 200 and the index
- shkkmo 3y agoYou only have to serve a 200 and the index for valid routes to have frontend routing working. The complaint is serving a 200 for invalid routes, which breaks all kinds of things and violates web standards.
- egeozcan 3y agoIndeed, for a cost-effective approach with a static host, why not generate placeholder HTML files for all valid routes at compile time? Alternatively, using Astro or a similar tool would be a wise choice :)
- antihero 3y agoThis isn’t really feasible, think about how dynamic routes can be? Can you generate a route for every ID of a thing?