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

Malindarajith's avatar

Laravel Session gets cleared after a redirect (IE only)

Hi Guys, Need some assistance on this annoying issue that happens only in IE.

I have code as below which sets the session values as below.

 session()->put('is_user_logged', true);
 session()->put('user_data', $user_data);
 Session::save();

After a redirection and when I do a var_dump(session()->get('user_data')), its always NULL. Before the redirection it is NOT NULL.

Searched the internet and tried the following solutions as well, but no joy. :(

  • Changed the 'cookie' => 'laravel_session' to be 'cookie' => 'laravelsession' in config/session.php

  • Moved the "StartSession" from $middlewareGroups to $middleware in kernel.php

  • Verified if 'domain' => env('SESSION_DOMAIN', null) has NULL in config/session.php

If anyone can shed some light on this would be highly appreciated.

Note that this is happening ONLY on IE. Works fine on Firefox and Chrome.

0 likes
2 replies
Sinnbeck's avatar

Which ie? Every ie version has its own little bugs

Please or to participate in this conversation.