Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Allow configuring the CSRF_TRUSTED_ORIGINS option

Roland Geider5ea4b630a4f9
diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py
index 4943c9b91..421230713 100644
--- a/extras/docker/development/settings.py
+++ b/extras/docker/development/settings.py
@@ -130,3 +130,8 @@ AXES_HANDLER = env.str('AXES_HANDLER', 'axes.handlers.cache.AxesCacheHandler')
SIMPLE_JWT['ACCESS_TOKEN_LIFETIME'] = timedelta(minutes=env.int("ACCESS_TOKEN_LIFETIME", 15))
SIMPLE_JWT['REFRESH_TOKEN_LIFETIME'] = timedelta(hours=env.int("REFRESH_TOKEN_LIFETIME", 24))
SIMPLE_JWT['SIGNING_KEY'] = env.str("SIGNING_KEY", SECRET_KEY)
+
+#
+# https://docs.djangoproject.com/en/4.1/ref/csrf/
+#
+CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS", ['http://127.0.0.1', ])
diff --git a/wger/settings.tpl b/wger/settings.tpl
index 3728091b9..cb39da72b 100644
--- a/wger/settings.tpl
+++ b/wger/settings.tpl
@@ -70,3 +70,10 @@ EMAIL_PAGE_DOMAIN = SITE_URL
# Your twitter handle, if you have one for this instance.
#WGER_SETTINGS['TWITTER'] = ''
+
+
+#
+# Sometimes needed if deployed behind a proxy, etc.
+# https://docs.djangoproject.com/en/4.1/ref/csrf/
+#
+# CSRF_TRUSTED_ORIGINS = ['http://127.0.0.1', 'https://my.domain.example.com']