Laravel maintains a session in a subdomain of another server

Suppose in the area ( app.domain.com ) I set up the following session:

 Session::put('test', 'value'); 

Then in another area (e.g. news.domain.com ) I want to get this session value. Please note that the other domain contains ON DIFFERENT SERVER , but the same domain name is still there.

My question is: will Session::get('test') available in news.domain.com if I set the laravel configuration file to domain => '*.domain.com' ?

+7
session cross-domain laravel-4
source share
1 answer

If you have subdomains hosted on different physical machines, set the following for the domain in app/config/session.php :

 'domain' => '.domain.com' 

will work until two applications can access the data store of the shared session (for example, using the database session driver and have a common database in which the sessions are stored).

+15
source share

All Articles