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

simoeslopes.carlos@gmail.com's avatar

Flashed Session Data Across Sub Domains

Hello everyone, I'm working on a multiple domain app built with Laravel 5.5. Session data are working correctly and I can authenticate users across domains. My struggle has been passing flashed data across domains. I can set session variables without a problem is just that I can't use: $request->session()->flash('message', '' . $greeting . ' ' . auth()->user()->firstname); for example. All help is highly appreciated

0 likes
4 replies
jlrdw's avatar

In session config, is the domain set correctly. Clear all cache after any changes to settings:

config:clear

But I'm sure you know that already.

siangboon's avatar

try this:

session()->flash('message', $greeting . ' ' . auth()->user()->firstname);
simoeslopes.carlos@gmail.com's avatar
Level 2

First of all, thanks for your answers. Your replies made me go through my code again and it just hit me. It must be a 2nd redirect. It's always the simple answer. Oh brother!!

Fix it with: $request->session()->reflash(); just before that 2nd redirect.

Please or to participate in this conversation.