How do I fix 'CSRF verification failed' when submitting a form in Django behind a proxy?
intermediate
· 5 views ·
asked 3 days, 11 hours ago
by Tai
0
Context
Django 5 app deployed behind a reverse proxy (Cloudflare in front of Render). The site is served over HTTPS at a custom domain. Login and contact forms include {% csrf_token %} and work perfectly on localhost.
Expected
Submitting any form on the production site should process normally.
What Happened
Every POST on production returns 403 Forbidden — CSRF verification failed. Origin checking failed even though the CSRF token is present in the form.
Question comments
Short clarifications and small follow-ups about the question itself.
No comments on the question yet.
0 Answers
No answers yet. Be the first to help!