auth: trust nginx HTTPS proxy for CSRF (SECURE_PROXY_SSL_HEADER + CSRF_TRUSTED_ORIGINS)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
6bad2a2ad1
commit
ba1f792826
@@ -162,3 +162,11 @@ SESSION_SAVE_EVERY_REQUEST = True
|
||||
LOGIN_URL = 'login'
|
||||
LOGIN_REDIRECT_URL = 'app-pantry'
|
||||
LOGOUT_REDIRECT_URL = 'login'
|
||||
|
||||
# Behind the nginx HTTPS reverse proxy: trust the forwarded scheme so Django
|
||||
# knows requests are HTTPS, and trust the site's origins for CSRF (needed for
|
||||
# the login POST and HTMX POSTs now that they're no longer csrf-exempt).
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
'https://food.tomflux.xyz',
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user