Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

SESSION_COOKIES_SAMESITE has to be 'strict' or 'lax' #19

Closed
huyb22 opened this issue Mar 18, 2020 · 6 comments
Closed

SESSION_COOKIES_SAMESITE has to be 'strict' or 'lax' #19

huyb22 opened this issue Mar 18, 2020 · 6 comments

Comments

@huyb22
Copy link

huyb22 commented Mar 18, 2020

  • django-cookies-samesite version: 0.5
  • Django version: 2.2.7
  • Python version: 3.7
  • Operating System: Linux

Description

Chrome now explicitly want us to set the SameSite = "None" to use cross domain cookies.
Django version 2.2.7 does not allow for SESSION_COOKIES_SAMESITE = "None".

What I Did

Install django-cookies-samesite with: pip install django-cookies-samesite
Add this on top of MIDDLEWARE: 'django_cookies_samesite.middleware.CookiesSameSite'
Set SESSION_COOKIES_SAMESITE = "None" in settings.py
Deploy the app with Docker

Result

Encountered this error when access to the webapp:
ValueError: samesite must be "lax" or "strict".

@jotes
Copy link
Owner

jotes commented Mar 18, 2020

@Fuih Hey,
It looks like Django produces that error because it uses the same setting and that creates a conflict.
A potential workaround for this problem is to use different names for those conflicting settings.

@estianross
Copy link

Is a fix for this on the way?

@jotes
Copy link
Owner

jotes commented Mar 19, 2020 via email

@jotes
Copy link
Owner

jotes commented Mar 19, 2020

@Fuih Hey,
Can you download the latest release (0.5.1) and add the following setting:

DCS_SESSION_COOKIES_SAMESITE = 'none'

and tell me if that fixed your problem?

@huyb22
Copy link
Author

huyb22 commented Mar 23, 2020

@jotes
After i did as the instructions, django no longer throws the error anymore. But since Chrome now required Samesite = "None" has to come with Secure = True in order to use cross domain cookies and i don't have https implemented, i can't test if the package work or not, sorry about that.

@jotes
Copy link
Owner

jotes commented Mar 26, 2020

@Fuih Don't worry :-) I'm going to close this issue then, because the workaround seems to work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants