VinothPHP
VinothPHP

Reputation: 821

Avoid session matching with two different domains in cakephp?

I have two different domains both are developed in cakephp, My problem is, When I have logged into anyone of domain, Its working fine and when I'm open another one in new tab, It will take same session data. Suppose, If I logged out anyone, both are logout. So I need separate sessions. And one project have ACL component and another one doesn't have.

I have tried with different security.salt values, Its not working. Please sugges me what is the best way to maintain the different sessions. Thanks in Advance.

Upvotes: 2

Views: 793

Answers (1)

JDR
JDR

Reputation: 1146

In your core.php, you could set the session-configuration to one of CakePHP's default-configurations which will then store your sessions in the respective app's tmp-directory.

 Configure::write('Session', array(
     'defaults' => 'cake', // instead of 'php'
     'cookie' => 'app_cookie1', // select a different one for each app
     [...]
 ));

Moreover, you should select a different cookie-name for each app so they are not both unset upon logout.

This should resolve the conflict. If you are interested in some more advanced settings, take a look here: http://book.cakephp.org/2.0/en/development/sessions.html

Upvotes: 3

Related Questions