英文:
Forbidden (403) CSRF verification failed. Request aborted on HTTPS
问题
我已在我的Linux服务器上托管了我的Django应用程序。第一次使用HTTP正常运行,但允许HTTPS后,出现错误Forbidden (403) CSRF verification failed. Request aborted. 我需要在我的服务器设置中添加什么内容?
我希望有人可以帮助我解决这个错误。
英文:
I have hosted my Django application on my Linux server. The first time it works fine by using HTTP but after allowing HTTPS it gives me an error Forbidden (403) CSRF verification failed. Request aborted. What should I need to add to my server setting?
I expect to have somebody who will help me to fix this error.
答案1
得分: 3
你需要列出所有信任的来源,使用 CSRF_TRUSTED_ORIGINS。
https://docs.djangoproject.com/en/4.2/ref/settings/#csrf-trusted-origins
英文:
You will have to list all trusted origins using CSRF_TRUSTED_ORIGINS
https://docs.djangoproject.com/en/4.2/ref/settings/#csrf-trusted-origins
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论