What is the correct value for SESSION_COOKIE_DOMAI

2019-09-06 13:26发布

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条回答
男人必须洒脱
2楼-- · 2019-09-06 13:56

Looks like:

SESSION_COOKIE_DOMAIN = 'domain.com'

solved the problem.

Hope this helps someone.

查看更多
登录 后发表回答