Issue
I recently migrated my Django project to HTTPS using Cloudflare. While it worked flawlessly with HTTP, I'm now encountering CSRF verification failed. Request aborted.
issues after the migration. When I tried logging into the admin panel
CORS_ALLOW_CREDENTIALS = True
ALLOW_ALL_ORIGINS = True
CORS_ALLOWED_ORIGINS = [
"https://example-domain.live",
"https://www.example-domain.live",
"www.example-domain.live
]
CORS_CSRF_COOKIE_SECURE = True
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Solution
Unfortunately, I can't recreate this on my local, but have you also added the middleware and CSRF_TRUSTED_ORIGINS
list as instructed in this documentation?
Answered By - Elin Malikzade
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.