Dec 17, 2024
0
Level 5
Session store not set on request.
I have Laravel as the backend and Nuxt js as frontend i used Session Sanctum here is the set up:
in my cors.php :
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
in app.php
->withMiddleware(function (Middleware $middleware) {
$middleware->statefulApi();
})
in sanctum.php:
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
.env file:
SANCTUM_STATEFUL_DOMAINS="is.test:9090"
my nuxt.config.ts:
devServer: {
port: 9090,
host: "is.test",
},
with this setup, everything works fine when the backend and frontend are local on my device... when I deploy the backend on a server and try to connect the from local Nuxt to the backend (deployed) I get error in Login Session store not set on request.
here is my .env in production:
SANCTUM_STATEFUL_DOMAINS="is.test:9090"
Please or to participate in this conversation.