Hat
Hat

Reputation: 1731

Django session cookies with and without www

I have a website built with Django and running Apache2 that can be accessed both at domain.com and www.domain.com, but if you log in on one, the cookie is only set for that specific version of the domain.

How can I set it so that either the cookie works on both versions of the domain, or that www.domain.com redirects to domain.com?

Upvotes: 0

Views: 87

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599470

Set SESSSION_COOKIE_DOMAIN to the common denominator, which is valid for both of them.

SESSION_COOKIE_DOMAIN = '.domain.com'

Upvotes: 3

Related Questions