Closed julianfox closed 1 month ago
It works perfectly when tested both locally & in production, see https://github.com/Atinux/nuxt-auth-utils/blob/main/playground/pages/secret.vue
how do you deploy your project in production? Do you have SSR disabled?
Thanks @atinux, I think I've found the issue:
routeRules: {
'/': { prerender: true },
},
I will test, but if I understand it right, prerender by definition do not use SSR?
Problem fixed; it was indeed due to my route rules configuration.
Hello, I'm having trouble figuring out how to redirect signed-in users right when the app starts.
My first attempt was to add middleware to my landing page ("/"):
This works perfectly in my local environment, but in production, the redirection doesn't happen, even though /api/_auth/session returns a 200 status.
I then tried a different approach:
This works, but there's a 2-3 second delay before the user is redirected. The landing page is rendered first, and then the user is redirected a few seconds later. It's better, but not ideal.
I also have a plugin that hooks into fetch on the server:
However, even when I remove this plugin, the problem persists.
Is there another solution to handle this more smoothly? Am I doing something wrong?