Forbidden (403) CSRF verification failed. Request aborted on HTTPS

huangapple go评论72阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年7月6日 18:58:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628099.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定