django CSRF origin error
Hello, I added my custom domain to CSRF_TRUSTED_ORIGINS on my Django project and it caused "Server Error: Application failed to respond." When I remove my custom domain and attempt to log in to my Django admin portal, I get the following error:
Forbidden (403)
CSRF verification failed. Request aborted.
Response headers:
HTTP/3 403 Forbidden
date: Thu, 04 Jan 2024 23:03:48 GMT
content-type: text/html; charset=utf-8
x-frame-options: DENY
x-content-type-options: nosniff
referrer-policy: same-origin
cross-origin-opener-policy: same-origin
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v3?s=3cj1TXcr5DTtnJ8mByt0pWUxQjBsul1UzpZ1em5EVFYS6gKnf0XHCWJypZ0JsoG%2FNeaWNdXPqgCggCLrwwm2Iy7pc7e2SEanbm5BDvqcGHnLERhZtz5jreeI4xab1BAwrJ5OCW3WBFpwcSvwEPln3Onn3Q%3D%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 84071def2f7c7ca9-LAX
content-encoding: br
alt-svc: h3=":443"; ma=86400
Please help?
2 Replies
Project ID:
5da5a191-97b5-4d00-96f0-9ecf3670251e
Service ID: 5da5a191-97b5-4d00-96f0-9ecf3670251e
The issue is now resolved--I'm not exactly sure how, since I had some security issues and ended up starting over with a new deployment and copying the files into a new folder etc etc. But now the CSRF errors I got when sending POST requests were resolved by adding my custom url to CSRF_TRUSTED_ORIGINS. So I'm just going to leave it be 😅