Support the ongoing development of Laravel.io →
Configuration Session

Laravel is running on my server which is set to a UTC timezone. PHP's timezone is also set to UTC.

When a user comes in, no matter where is she from, a cookie is set with and absolute date relative to server's time:

Set-Cookie	my_app_session=XXX..XXX%3D; expires=Sun, 21-Sep-2014 09:57:16 GMT; path=/; httponly

This is a total fail for a user who is from, say, UTC+7 – if she's on Safari or other browser that takes cookie expiring time seriously, the cookie is not saved, session is not kept till next request, even if its an ajax call within a second after.

How can I tweak this behavior to set expiring time in seconds after the cookie has been set, or make it a session cookie with no expire parameter?

Last updated 3 years ago.
0

Apparently, setting

'expire_on_close' => true,

in app/config/session.php solves the issue.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sergiks sergiks Joined 21 Sep 2014

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.

© 2025 Laravel.io - All rights reserved.