hookrouter
hookrouter copied to clipboard
Provide metadata for SSR when redirecting
trafficstars
use cases:
- Differentiate between temporary 302 (e.g. after completing a form or changing the language) and permanent 301 redirects (paths that no longer exist)
- Be able to tell the SSR to return 404 but still render content, not redirecting on the client side
Working on 2.0 right now and I am thinking about this but am not sure about all of that.
The 302 is straightforward. I dare to say every call to useRedirect serverside should be a 302 redirect.
301 redirects are complicated and I am not sure if they should be handled by hookrouter at all. You would have to keep an ever-growing list of URLs in your frontend code to be able to detect 301s, because you cannot just leave them out. Leaving them out means they automatically become 404s.