No redirection using throw redirect in middleware
Hello, there is something I don't understand, below is my setup, why the redirect does not work ?? I just get an error on my ErrorCatchBoundary. It is like the error is not handled by the router lifecycle, but I don't understand why....
when the throw redirect is hit i just get my "An error occurred page" instead of a redirection. (I'm using SPA mode, defaultSsr to false in router and a shell component for information).
Thanks in advance :).
3 Replies
wise-white•4mo ago
can you please create a GitHub issue including a complete minimal example for this?
ratty-blushOP•4mo ago
I can try but in the mean time I can show you the results of my global error middleware when I console log the object:
When I have a redirection in a middleware I got a Response 307 object.
whereas the notFound works as expected and the returned data are:
ratty-blushOP•3mo ago
The problem is already open on GitHub: https://github.com/TanStack/router/issues/4460
The solution of JsonKim work as a workaround for now 🙂
GitHub
Can't redirect in server functions with middleware · Issue #4460 ...
Which project does this relate to? Start Describe the bug Throwing redirects in server functions that use middleware doesn't work. It works fine if I remove the middleware. I am using the useSe...