Authentication for multiple subdomain in CakePHP


Let say you have subdomain and

If you login to and when you access you notice that you already authenticate althought the subdomain is different.

So how you want to differentiate the session after you login since the default setup of CakePHP will consider you on the same site ?

Edit your bootstrap.php in app / config and try to put this line .

ini_set(‘session.cookie_domain’, env(“HTTP_HOST”));

You can validate your cookie by installing Firebug in Firefox and installing an extension for firebug which is call ‘Firecookie‘.

Cheers ~!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.