## Summary - Closes #18 - Logout POST was failing CSRF Origin checks on HTTPS because `CSRF_TRUSTED_ORIGINS` was unset (Django 5) - Derive trusted origins from `DJANGO_ALLOWED_HOSTS` (override via `DJANGO_CSRF_TRUSTED_ORIGINS`) - Trust reverse-proxy TLS headers in prod/beta (`SECURE_PROXY_SSL_HEADER`, secure cookies) ## Test plan - [x] `python manage.py test public.tests.CsrfTrustedOriginsTests public.tests.LogoutCsrfTests` - [ ] Deploy, log in on aimloperations.com, click Log Out → redirect home, no 403 - [ ] Confirm login still works after deploy Reviewed-on: #19
This commit was merged in pull request #19.
This commit is contained in:
@@ -7,6 +7,8 @@ DJANGO_ENV=prod
|
||||
DJANGO_DEBUG=false
|
||||
DJANGO_SECRET_KEY=replace-with-a-long-random-secret
|
||||
DJANGO_ALLOWED_HOSTS=aimloperations.com,www.aimloperations.com
|
||||
# Optional override; when unset, https:// origins are derived from DJANGO_ALLOWED_HOSTS.
|
||||
# DJANGO_CSRF_TRUSTED_ORIGINS=https://aimloperations.com,https://www.aimloperations.com
|
||||
|
||||
# Logging (optional override; defaults: dev=DEBUG, beta=INFO, prod=WARNING)
|
||||
# DJANGO_LOG_LEVEL=WARNING
|
||||
|
||||
Reference in New Issue
Block a user