News for hackers. Stuff that matters.
Re:Web servers should refuse requests for random, unnecessar... by nubinetwork on Thursday July 06, 2023 @06:46AM (#36613952)
I would argue that is still wrong... if the page doesn't exist, you either 404, or 301 to a page that does exist.
Re:Web servers should refuse requests for random, unnecessar... by Timon3 on Thursday July 06, 2023 @07:24AM (#36614221)
That would require you to duplicate all routing between backend and frontend. As long as it's not an API I don't see the need.
Re:Web servers should refuse requests for random, unnecessar... by shkkmo on Thursday July 06, 2023 @02:57PM (#36621021)
> As long as it's not an API I don't see the need.

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

Re:Web servers should refuse requests for random, unnecessar... by Timon3 on Thursday July 06, 2023 @03:49PM (#36621800)
> And I don't see the need to use a SPA almost anywhere.

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.

Re:Web servers should refuse requests for random, unnecessar... by shkkmo on Thursday July 06, 2023 @04:04PM (#36622003)
> 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.

Re:Web servers should refuse requests for random, unnecessar... by Timon3 on Thursday July 06, 2023 @04:19PM (#36622244)
> Why are you using SPAs with internal routing for small tools?

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.

Re:Web servers should refuse requests for random, unnecessar... by wruza on Thursday July 06, 2023 @04:00PM (#36621942)
I see the need for SPA on every site that has internal links and dynamic state of any kind. Seeing a flash is annoying and so is tapping back button only to see the cached version that is not true anymore and forcing a reload. Interop between web pages (and tabs) is practically non-existent. Even right now on HN I’m about to post a comment, and the whole “go back” stack will become irrelevant.

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.

Re:Web servers should refuse requests for random, unnecessar... by wruza on Thursday July 06, 2023 @04:12PM (#36622120)
Wouldn’t it be better to auto-extract a list of frontend routes for backend? Our stacks lack the obvious, but instead of fixing them we are searching for good angles.
Re:Web servers should refuse requests for random, unnecessar... by Timon3 on Thursday July 06, 2023 @04:21PM (#36622260)
It depends on your use case. My use case doesn't warrant it.