内容简介:参考;今天遇到个问题:某父页面(a.com ) 使用iframe 包含子页面(b.com)时,发现页面是空白页, 显示的是:
nginx - 处理Refused to display 'url'... in a frame because it set 'X-Frame-Options' to 'sameorigin'.
访问量: 5
https://stackoverflow.com/questions/27358966/how-to-set-x-frame-options-on-iframe
今天遇到个问题:某父页面(a.com ) 使用iframe 包含子页面(b.com)时,发现页面是空白页, 显示的是:
Refused to display 'url'... in a frame because it set 'X-Frame-Options' to 'sameorigin'.
原因是: 子页面的response并没有返回 相关的header.
解决办法:
为子页面的nginx 中,添加:
location ~ ^/(images|javascripts|stylesheets|upload|assets|video)/ { root /mnt/www/your-project/public; expires 30d; add_header Cache-Control public; add_header ETag ""; add_header X-Frame-Options "allow-from http://a.com"; // a.com 是父页面 }
另外, 对于chrome ,可能还需要多返回一个: (参考: https://stackoverflow.com/questions/30731290/how-to-set-x-frame-options-allow-from-in-nginx-correctly )
add_header Content-Security-Policy: frame-ancestors a.com
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 自然语言处理之数据预处理
- Python数据处理(二):处理 Excel 数据
- 什么是自然语处理,自然语言处理主要有什么
- 集群故障处理之处理思路以及健康状态检查(三十二)
- Spark 持续流处理和微批处理的对比
- Android(Java)日期和时间处理完全解析——使用Gson和Joda-Time优雅地处理日常开发中关于时间处理的...
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Trading and Exchanges
Larry Harris / Oxford University Press, USA / 2002-10-24 / USD 95.00
This book is about trading, the people who trade securities and contracts, the marketplaces where they trade, and the rules that govern it. Readers will learn about investors, brokers, dealers, arbit......一起来看看 《Trading and Exchanges》 这本书的介绍吧!