Django nginx拒绝显示在框架中,因为它将"X-Frame-Options"设置为"SAMEORIGIN" [英] Django nginx Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'
问题描述
我已经在具有nginx和uwsgi的服务器上部署了django Web应用程序.我可以使用ip地址完美访问该网站.
I have deployed a django web application on a server with nginx and uwsgi. I can access the site perfectly using the ip address.
我购买了一个域名,例如abc.example.com,并将其指向我的IP地址.现在,当我转到域名时,它将加载一个空白页面并在浏览器控制台中引发错误:
I purchased a domain name say abc.example.com and pointed it to my ip address. Now when i go the domain name it loads a blank page and throws an error in browser console:
在Chrome中:
Refused to display 'ip address' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
在Mozilla中:
Load denied by X-Frame-Options: 'ip address' does not permit cross-origin framing.
关键是我在整个应用程序中都没有任何iframe.
这是什么错误,我该如何解决?
What is this error and how can i solve it?
当我使用ip地址转到应用程序时,它可以按预期的那样完美运行.那么域的问题是什么?我仔细检查了Godaddy的dns区域中的设置,但什么也没弄清.
When i go to application using ip address it works perfectly as it is supposed to be. Then what is the problem with domain? I double checked the settings in dns zone on godaddy but couldn't figure out anything.
推荐答案
在"settings.py"文件中,添加这两行.可能会对您有帮助.
In 'settings.py' file, add these two lines. It may help you.
X_FRAME_OPTIONS = 'ALLOWALL'
XS_SHARING_ALLOWED_METHODS = ['POST','GET','OPTIONS', 'PUT', 'DELETE']
这篇关于Django nginx拒绝显示在框架中,因为它将"X-Frame-Options"设置为"SAMEORIGIN"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!