Redirect on +page.server.js has a different behavior on production server compared to dev #11981
-
I've been trying to solve this issue for 3 days now with no real progress. I've asked on discord and looked on the web for answers but I can't really find any. I have a website that runs perfectly when running on the dev server but as soon as I upload it to my VPS running nginx I get weird behaviors with the protected routes redirects. I have a and a When a user signs in the locals object gets populated with the user information like so: Which then sends a response with the signedIn boolean set to true which the client then uses to The And this is what the This is what my svelte config looks like: Now, when I try signin in the dev server everything flows correctly but when I try to do it on the production server this is what I get: The thing is I still get the response from the server and it is signing me in but I can't go past the
Cookie correctly set: What bothers me the most is that if I go directly from the base route What is going on? Why are my 307 redirects getting ignored and why can't I get past the signin page? I have no idea what to do, any help is greatly appreciated. Just so it is clear, the development server works correctly and I have no issues with it, it is only with the production server. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Here is a quick comparison in a video: vid_2024_03_14_14_53_58.mp4 |
Beta Was this translation helpful? Give feedback.
-
Thanks to Patrick's suggestion on discord I solved it by making the routes non prerenderable... So it was an easy fix but not very clear since it worked on the dev server! |
Beta Was this translation helpful? Give feedback.
Thanks to Patrick's suggestion on discord I solved it by making the routes non prerenderable... So it was an easy fix but not very clear since it worked on the dev server!