From ce7afd0889cec5744e7b8a902b2607873f1826c2 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Fri, 6 Oct 2023 19:35:32 +0500 Subject: [PATCH] fix: add conditional trusted origins update (#563) * fix: add conditional trusted origins update --- registrar/settings/base.py | 1 + registrar/settings/production.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/registrar/settings/base.py b/registrar/settings/base.py index 571092e36..16ad0cba6 100644 --- a/registrar/settings/base.py +++ b/registrar/settings/base.py @@ -325,6 +325,7 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = False STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' CSRF_TRUSTED_ORIGINS = [] +CSRF_TRUSTED_ORIGINS_WITH_SCHEMES = [] # temporary setting for Django 4.2 support CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', diff --git a/registrar/settings/production.py b/registrar/settings/production.py index 3ac51fa2c..874e8c29e 100644 --- a/registrar/settings/production.py +++ b/registrar/settings/production.py @@ -1,4 +1,5 @@ from os import environ +import django import yaml from registrar.settings.base import * @@ -53,3 +54,6 @@ CELERY_BROKER_HOSTNAME, CELERY_BROKER_VHOST ) + +if django.VERSION[0] >= 4: # for greater than django 3.2 use schemes. + CSRF_TRUSTED_ORIGINS = CSRF_TRUSTED_ORIGINS_WITH_SCHEMES