Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hsntngr's avatar

Session losts when close the browser tab

I just deployed my laravel application on shared hosting. I used the way that what @snapey suggest at this topic https://laracasts.com/discuss/channels/laravel/how-to-deploy-laravel-on-shared-hosting-properly

After the deployment I realized that whenever I close the browser and reopen any page that doesn't require authtentication (like homepage) session has hone. But if I open any admin route I'm able to see that page. It doesn't redirect me login page. Just validates cookies and login me

I don't know if any help but it also creates new session file beneath the storage/framework/sessions..

Before the above changing everything was fine, still on my local server sessions works well. But I'm getting this strange behavior and how can I fix it ?

0 likes
2 replies
Cronix's avatar

Do you have expire_on_close set to true in your session config? If the logged in person selected the remember me checkbox when the logged in, of course it automatically logs them in via the cookie when visiting those routes.

hsntngr's avatar

@cronix nope it's false (expire_on_close) . Problem is checkbox is checked, everything was working fine until I deploy application with different way.. I don't know what happened..

Also I realized, when go to admin routes http start to turns into https. No ssl configurations, I don't what causes those problems..

Please or to participate in this conversation.