Support the ongoing development of Laravel.io →
posted 7 years ago
Session
Last updated 1 year ago.
0

why use file, try database. it's much better anyway.

0

I had tried using 'cookie', 'database', 'file' and all my sessions just randomly get expired. Any idea why this happen?

0

I had similar problem with sessions, you might want to check this out

5.2 - Weird session behaviour with routes in web middleware group

"However since 5.2.27 all routes are registered in the web middleware group by default"

So, if your routes are wrapped with 'web' middleware

Route::group(['middleware' => ['web']], function() {
  ...
});

remove that and see if it helps.

That helped me

Edit: To see which version of Laravel you have, run

php artisan --version

To check if middleware is loaded twice, run

php artisan route:list
Last updated 7 years ago.
0

I had tried add or remove the routes from web middleware, both still have same issue with random expired sessions. I can confirm that there is no duplicate middleware running through route:list.

Somehow I do not know why the problem suddenly gone itself without any more settings after two days. Not sure it will come back in the future or not.

0

Make sure U don't do a "die and dump" on session variable, for debugging purposes, as I did. :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jitkang jitkang Joined 2 Jun 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.