增加HTTPS_DOMAINS环境变量,用于设定反向代理域名,解决CSRF中断问题

This commit is contained in:
ngfchl
2022-10-07 20:06:30 +08:00
parent 9b5a7d5aec
commit f6703b325b

View File

@@ -35,6 +35,9 @@ SECRET_KEY = 'django-insecure-6wrh^t$@gbb^s^=79@%cv=%yhq6gl^kane#g@-n-*n6+s1lo2f
DEBUG = True
ALLOWED_HOSTS = ['*']
CORS_ORIGIN_ALLOW_ALL = True
if os.environ.get('HTTPS_DOMAINS'):
CSRF_TRUSTED_ORIGINS = [os.environ.get('HTTPS_DOMAINS'), ]
# Application definition