How do I fix 'CSRF verification failed' when submitting a form in Django behind a proxy?

0votes

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.

Submitting any form on the production site should process normally.

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 follow-ups about the question itself.

No comments yet.

0 Answers

No answers yet

There are no published answers to show.

Your answer

Sign in to share a solution.