小编use*_*836的帖子

内容安全策略框架-祖先

我正在尝试将内容加载到 IFrame 中,因此我实现了 Content-Security-Policy 标头:Content-Security-Policy:frame-ancestors http://*.example.com/abc.html。

当我将标头指定为 Content-Security-Policy:frame-ancestors http://*.example.com/ 时,我可以在 iframe 上加载内容。

但是当我将标题更改为:Content-Security-Policy:frame-ancestors self http://*.example.com/abc.html。然后 iframe 上的内容第一次加载,但当我刷新网页时出现以下错误

拒绝在框架中显示“https://...”,因为祖先违反了以下内容安全策略指令:frame-ancestors self http://*.example.com/abc.html。

谁能告诉我为什么刷新页面时会出错。框架祖先还考虑完整的 url (http:// .example.com/abc.html) 还是只考虑主机名,如 http:// .example.com?

security iframe mozilla frame content-security-policy

10
推荐指数
1
解决办法
4万
查看次数