Skip to content

Commit

Permalink
Change CSRF settings
Browse files Browse the repository at this point in the history
  • Loading branch information
e-mit committed Jun 26, 2024
1 parent 58cd9fd commit f25c3b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions django_app/django_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,13 @@
STATICFILES_DIRS = [
BASE_DIR / 'project_static'
]

# CSRF setup

if not DEBUG:
CSRF_TRUSTED_ORIGINS = [f'https://{x}' for x in ALLOWED_HOSTS]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# These are for https only:
# CSRF_COOKIE_SECURE = True
# SESSION_COOKIE_SECURE = True

0 comments on commit f25c3b3

Please sign in to comment.