@adityar15 You would have to configure your session cookie domain (inside session.php) for that. By default the session cookie would be valid for the subdomain you logged in to (e.g. abc.example.com). Setting the domain value to '.example.com' would make the cookie be valid for all of your subdomains.
Feb 3, 2021
3
Level 2
How does Laravel session works for subdomains?
Suppose I have more than one subdomain (for simplicity 3) each pointing to the same Laravel project hosted on Elastic Beanstalk instance.
Now if someone logs in on domain abc.example.com and visits xyz.example.com, will the person share the same session status on both domains? For instance, say in the code in the menu there are lines in the blade file
@if(session('isloggedIn')
<li> Account </li>
@else
<li> Login </li>
@endif
Now if person A logs in on abc.example.com, they will see Account in the menu. Now if the person visits xyz.example.com will they see Account or Login in the menu?
Thanks in advance :)
Please or to participate in this conversation.