Laravel Session always changes every refresh / request in Laravel 5.4

后端 未结 6 780
春和景丽
春和景丽 2020-12-01 12:38

So the title basically says it all, I am using Laravel 5.4, PHP 7.1 and on my local machine sessions are working just fine. Essentially when trying to login or reloading the

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 13:23

    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.

提交回复
热议问题