首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试理解Content-Security-Policy框架祖先标记

我正在尝试理解Content-Security-Policy框架祖先标记
EN

Stack Overflow用户
提问于 2019-05-23 16:42:42
回答 2查看 465关注 0票数 1

我正试图在我的IONIC应用程序内的iframe中显示我的一个网站。我需要限制我的网站被其他网站iframed。我决定使用content-security-policy响应头,其中

Content-security-policy: frame-ancestors ${website-to-be-allowed}

确保只有提到的网站可以iframe我的网站,但是我需要我的离子应用程序来iframe我的网站,因为离子应用程序是作为文件系统,我可以给所有的文件系统访问iframe我的网站。当我添加

Content-security-policy: frame-ancestors ${website-to-be-allowed} filesystem

正如这里提到的,https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors

我在我的Android和IOS应用程序上进行了测试,两者都抛出了相同的错误,这表明,

Refused to display ${website} in a frame because an ancestor violates the following content security policy directive: "frame-ancestors filesystem"

下面是弹出enter image description here的错误

EN

回答 2

Stack Overflow用户

发布于 2021-04-23 19:47:20

仅供参考,我使用以下命令使其正常工作:

file://* filesystem:

因此,总体内容安全策略可能如下所示:

Content-Security-Policy: "...; frame-ancestors 'self' file://* filesystem:;

票数 3
EN

Stack Overflow用户

发布于 2019-05-30 23:44:46

你需要在"filesystem“的末尾加上冒号。试一试

frame-ancestors ${website-to-be-allowed} filesystem:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56271316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档