[Django]-How to disable Django's CSRF protection behind a proxy

0👍

The fault was all on my side. By checking the server logs I realized that not Alfred was throwing the error but the Proxy (django-httpproxy). Probably, because both servers are running on localhost, and I’m sending my requests from localhost as well. I disabled CSRF for both, Proxy and Alfred.
With this setup i don’t get any 403 Errors anymore.

Unfortunately, the django-httpproxy looses cookies, so I can’t log in because of that.

Lesson learned: don’t use django-httpproxy as reverse proxy.

3👍

You can use the @csrf_exempt decorator on the view functions to disable csrf for that view.

See the documentation

👤RickyA

Leave a comment