Skip to content

Commit 27f2893

Browse files
authored
Merge pull request #738 from RobinBeismann/develop
Added environment variable for CSRF_TRUSTED_ORIGINS
2 parents 5c4a1cc + 19280c2 commit 27f2893

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

configuration/configuration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def _read_secret(secret_name, default = None):
120120
CORS_ORIGIN_WHITELIST = list(filter(None, environ.get('CORS_ORIGIN_WHITELIST', 'https://localhost').split(' ')))
121121
CORS_ORIGIN_REGEX_WHITELIST = [re.compile(r) for r in list(filter(None, environ.get('CORS_ORIGIN_REGEX_WHITELIST', '').split(' ')))]
122122

123+
# Cross-Site-Request-Forgery-Attack settings. If Netbox is sitting behind a reverse proxy, you might need to set the CSRF_TRUSTED_ORIGINS flag.
124+
# Django 4.0 requires to specify the URL Scheme in this setting. An example environment variable could be specified like:
125+
# CSRF_TRUSTED_ORIGINS=https://demo.netbox.dev http://demo.netbox.dev
126+
CSRF_TRUSTED_ORIGINS = list(filter(None, environ.get('CSRF_TRUSTED_ORIGINS', '').split(' ')))
127+
123128
# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal
124129
# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging
125130
# on a production system.

0 commit comments

Comments
 (0)