Last active
December 30, 2020 19:28
-
-
Save makerj/295ea3d2160326694c123bd8db164d9b to your computer and use it in GitHub Desktop.
HOW TO SHARE COOKIE ACROSS SUBDOMAINS IN DJANGO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PRODUCTION SETTINGS AREA | |
""" | |
if not DEBUG: | |
# share cookie across sub-domains. LEADING DOT IN DOMAIN STRING will acts like a wildcard for sub-domain | |
DOMAIN = '.phople.us' | |
CSRF_COOKIE_DOMAIN = DOMAIN | |
SESSION_COOKIE_DOMAIN = DOMAIN | |
SESSION_COOKIE_AGE = 1209600 # 2 weeks | |
""" | |
Following value should be same in all your django applications | |
CSRF_COOKIE_DOMAIN | |
CSRF_COOKIE_NAME | |
SESSION_COOKIE_DOMAIN | |
SESSION_COOKIE_NAME | |
SECRET_KEY | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment