我最近使用 Cloudflare 将 Django 项目迁移到 HTTPS。虽然它与 HTTP 完美配合,但我现在在迁移后遇到了
CSRF verification failed. Request aborted.
问题。当我尝试登录管理面板时
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')