What is the correct value for SESSION_COOKIE_DOMAIN if my Django site is set up on a subdomain?

﹥>﹥吖頭↗ 提交于 2019-12-11 14:55:00

问题


I have constant problem with cookies on my Django site which is set up on a subdomain. It works for a couple of days, then message 'your browser doesn't accept cookies' appears on a login page. I need to restart my web server to make it work for a couple of next days and this cycle repeats.

This is really frustrating. I am not sure what am I doing wrong. I suspect that SESSION_COOKIE_DOMAIN might be set to a wrong value. What is the proper way to set it?

  1. SESSION_COOKIE_DOMAIN = 'subdomain.domain.com'
  2. SESSION_COOKIE_DOMAIN = '.domain.com'
  3. SESSION_COOKIE_DOMAIN = ''
  4. other?

Any help is appreciated. It behaves very strange for me (I mean that everything works after web server is restarted...). Maybe the problem lies in configuration of web server?


回答1:


Looks like:

SESSION_COOKIE_DOMAIN = 'domain.com'

solved the problem.

Hope this helps someone.



来源:https://stackoverflow.com/questions/3095944/what-is-the-correct-value-for-session-cookie-domain-if-my-django-site-is-set-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!