Replies: 1 comment 7 replies
-
Even if I disable SSR, log in successfully, and have: client: {
initialRequest: true,
} When I refresh the page, it redirects me to the login. What could I be doing wrong? |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Laravel Valet to serve my backend via
https://api.calenzia.test/api/
, and in the browser everything works fine — I can log in and use the session without problems.However, when I refresh the page, the session is lost unless I disable the initial user fetch:
But if I enable:
Then I get this error during SSR:
I believe this is because Node.js cannot resolve
api.calenzia.test
internally, even though I have this in my/etc/hosts
:And in the Nuxt server logs I see:
Nuxt Configuration
I'm using SSL via
mkcert
. Here's the config:nuxt.config.ts
.env
(frontend)Laravel Configuration
config/cors.php
.env
(backend)The problem
Even though everything works in the browser, SSR fails to resolve or trust
api.calenzia.test
, likely due to the Valet self-signed certificate not being trusted by Node.js (during SSR). SettingNODE_TLS_REJECT_UNAUTHORIZED=0
might help temporarily, but it’s not ideal.Question
❓ Does anyone know how to make SSR authentication work with Laravel Valet (HTTPS) and Nuxt 3 using
initialRequest: true
?Any guidance or best practices would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions