diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 6d850dc90..d5857f90d 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -494,6 +494,7 @@ class Config(dict): 'SESSION_COOKIE_SECURE': False, 'CSRF_COOKIE_SECURE': False, 'REFERER_CHECK_ENABLED': False, + 'CSRF_TRUSTED_ORIGINS': '', 'SESSION_ENGINE': 'cache', 'SESSION_SAVE_EVERY_REQUEST': True, 'SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE': False, diff --git a/apps/jumpserver/settings/base.py b/apps/jumpserver/settings/base.py index 84f9215fa..554ff50d0 100644 --- a/apps/jumpserver/settings/base.py +++ b/apps/jumpserver/settings/base.py @@ -59,6 +59,9 @@ SITE_URL = CONFIG.SITE_URL # https://docs.djangoproject.com/en/4.1/ref/settings/ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +# https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-CSRF_TRUSTED_ORIGINS +CSRF_TRUSTED_ORIGINS = CONFIG.CSRF_TRUSTED_ORIGINS.split(',') if CONFIG.CSRF_TRUSTED_ORIGINS else [] + # LOG LEVEL LOG_LEVEL = CONFIG.LOG_LEVEL