Django nginx Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

天涯浪子 提交于 2020-01-24 04:23:26

问题


I have deployed a django web application on a server with nginx and uwsgi. I can access the site perfectly using the ip address.

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:

In Chrome:

Refused to display 'ip address' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

In Mozilla:

Load denied by X-Frame-Options: 'ip address' does not permit cross-origin framing.

The point is I dont have any iframe in my whole Application.

What is this error and how can i solve it?

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.


回答1:


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']


来源:https://stackoverflow.com/questions/37694881/django-nginx-refused-to-display-in-a-frame-because-it-set-x-frame-options-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!