Why is redirect not supported from __error.svelte cmpt?
See original GitHub issueI have a small reproducible example here.
In the __error.svelte
cmpt I have thrown in a redirect like this in the load function:
return {
status: 302,
redirect: '/login'
}
But this is not working. Is this a bug, not allowed - or do I misunderstand something here?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:11 (7 by maintainers)
Top Results From Across the Web
SvelteKit: redirect() not working on server without disabling ssr
I found the problem. The culprit was the status code I was using for redirecting. I was providing the wrong status code 300...
Read more >Redirect wont work : r/sveltejs - Reddit
Having issues in getting a Svelte endpoint to redirect. ... It redirects the fetch route not the website the user is on.
Read more >Untitled
#Ukmath, Me without you loick essien cover, Linotype fontexplorer x pro mac, ... Heart rate monitor polar not working, Memmen bedeutung, Garmin 3590...
Read more >the of and to a in for is on s that by this with i you it not
the of and to a in for is on s that by this with i you it not or be are from at...
Read more >skb - ALBA.Net
Los angeles guitar quartet, Man working hard pictures, Unitary hecke character? ... Kabanata 2 noli me tangere, Heil heat pump not working, Isorno...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I talked about this with the rest of the maintainers at today’s maintainer’s meeting. Folks suggested you could already do this in one of a couple ways:
[fallthough].svelte
that would catch any unhandled routes and redirect therehandle
. (callresolve
, check the returned status, and then do a redirect based on that)There was a consensus that redirecting on error pages is in general a bit of a weird thing to do and so folks didn’t want to add support for it directly into the router, but instead suggested it be handled in these other ways since it’s a relatively uncommon use case
Hey I’ve added a [fallthough].svelte but it doesn’t catch 404 form urls with subsequent path: /someInvalidUrl => ok /someInvalidUrl/otherPage => not ok Any ideas to catch all urls that are giving 404s?