I am trying to access django admin with my credentials. No matter whether the credentials are correct or not I just keep geeting 403 forbidden with the reason "CSRF cookie not set". Using chrome dev tools I can clearly see the CSRF cookie in the network tab under response headers. Does anyone know how to fix this and regain access to django admin???
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.Community– Community Bot2025年05月24日 23:10:35 +00:00Commented May 24, 2025 at 23:10
1 Answer 1
You might have to provide more information such as the complete error logs and your settings.py.
One way to fix this issue is to set CSRF_TRUSTED_ORIGINS:
CSRF_TRUSTED_ORIGINS =['http://yourdomain.com', 'https://yourdomain.com']
Also if you are accessing the website through a proxy or firewall, ensure that they are not blocking the necessary cookies.
See Django Forum