Reputation: 465
I searched everywhere but could not find how to prevent the session(cookie?) from getting refreshed in Laravel.
I'm now migrating my website from Codeigniter to Laravel.
In Codeigniter, if you set the session expire time to 1 hour, the session will expire in one hour even if you're actively opening the website or not.
In Laravel, the session is always getting refreshed everytime I open a page.
For example, if I login at 00:20 and set the expiration to 1 hour(01:20), and then I open a page at 00:50, the expiration time will be refreshed to 01:50.
My question is, how to prevent this behavior in Laravel? I want it to stay at 01:20 like Codeigniter does.
Upvotes: 2
Views: 2839
Reputation: 5806
The session config can you find in config/session.php
.
'lifetime' => 120, // in minutes, default 2 hours
'expire_on_close' => false,
That's all. Below the explanation about session logic.
The session handling of Laravel is full logic. Let's me give an example:
It's very secure for you that Laravel refreshes the session! It's more difficult to 'catch' the session by attackers!
So I will recommend you the Laravel approach instead of the (outdated) CodeIgniter approach.
Upvotes: 1