Search code examples
symfonysessioncookiessubdomainsymfony-3.3

Symfony 3 sharing cookies across sub-domains?


I want to share a cookie across any subdomain. This should then allow me to keep the session. I am using the Symfony framework version 3.0.

I've read that you should set the following:

## app/config/config.yml
   session:
       cookie_domain: .localhost

I tried multiple variations on this but none of them change anything. the domain associated with the cookie won't change. Any ideas how this should be done?? What am I missing.


Solution

  • To be sure you need to delete your cookie and log back.

    session:
        cookie_lifetime: 0
        save_path: %kernel.root_dir%/var/sessions
        cookie_domain: .my-domain.com
        name: SFSESSID