Update settings.py

This commit is contained in:
Eugene Pankov 2021-07-26 22:13:06 +02:00
parent c7f8cdf623
commit 8fe3bf10f5
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -239,8 +239,16 @@ if FRONTEND_URL:
'x-xsrf-token',
'x-requested-with',
]
CSRF_TRUSTED_ORIGINS = [urlparse(FRONTEND_URL).hostname]
frontend_domain = urlparse(FRONTEND_URL).hostname
CSRF_TRUSTED_ORIGINS = [frontend_domain]
SESSION_COOKIE_DOMAIN = frontend_domain
CSRF_COOKIE_DOMAIN = frontend_domain
FRONTEND_URL = FRONTEND_URL.rstrip('/')
if FRONTEND_URL.startswith('https://'):
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
else:
FRONTEND_URL = ''