Laravel Session always changes every refresh / request in Laravel 5.4

We got threw this error too, and this is what seems to fix the problem :

• Check that your storage/ folder have the correct right

• Try to disable all the JavaScript in your pages (either by disabling it via navigator or inside the code) and make sure that 'http_only' => true,

• Try to use with and without HTTPS

• Make sure the SESSION_DRIVER variable is NOT null

• Try to switch between 'encrypt' => false, and 'encrypt' => true,

• Try to change the cookie name 'cookie' => 'laravelsession',

• Try either to set your SESSION_DOMAIN to your actual domain OR null

• Try to switch between 'secure' => env('SESSION_SECURE_COOKIE', false), and 'secure' => env('SESSION_SECURE_COOKIE', true),

After every step, this bug seems to be fixed, but somehow, the cookie still is not set in the navigator sometime until we use HTTPS on development too.

I am sorry not to be able to provide a 100% fix, but having the EXACT same issue, I wanted to share my experience with you.

Leave a Comment