Issue
When I set SESSION_COOKIE_DOMAIN = '.mysite.com'
and then run the production site, the site creates the proper cross domain cookie and it's set to .mysite.com
. However, if I set SESSION_COOKIE_DOMAIN = '.localhost'
and run the local development server at localhost:8000
the cookie that is created is the non-cross domain cookie localhost
.
Why might this be the case?
Thanks.
Solution
This has to do with how browsers and cookies work. Because you're not allowed to set cookies to something like .com, you can't set it as .localhost either.
You can check out more here: https://code.djangoproject.com/ticket/10560. Looks like there's no real solution within Django for this. I do wish they would warn us though rather than just break.
I don't have a good solution though. For testing you could set your hosts file to use something like test.com instead of localhost to point to your runserver.
Answered By - Jeff
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.