【问题标题】:Refused to frame ‘https://my.matterport.com/’ because an ancestor violates the following Content Security Policy directive: “frame-ancestors ‘self’”拒绝构建“https://my.matterport.com/”,因为祖先违反了以下内容安全策略指令:“frame-ancestors 'self'”
【发布时间】:2021-09-08 10:17:52
【问题描述】:

我正在尝试通过 _headers 文件将内容安全策略添加到我的 Gatsby x Netlify 网站。一切正常,除了不想显示的 Matterport iFrame。我在控制台看到的错误信息是

Refused to frame 'https://my.matterport.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".

在我的头文件中,我添加了以下 X-Frame-Options:

X-Frame-Options: ALLOW-FROM https://*.matterport.com/

我的内容安全政策中也有这个frame-src

frame-src 'self' https://www.youtube.com/ https://my.matterport.com https://matterport.com;

但 iFrame 仍然看起来像这样: Matterport iFrames not displaying

谁能帮我弄清楚我在这里做错了什么?

谢谢!

【问题讨论】:

    标签: security iframe netlify matterport


    【解决方案1】:

    我最近遇到了同样的错误消息,并通过删除视频链接前的双斜杠来纠正这个问题,我原来的 iFrame 包含看起来像:https://my.matterport.com/show//?m=XXXXXXX 将其替换为 https://my.matterport.com/show/?m=XXXXXXX 足以让 iFrame 再次显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-02
      • 2016-11-26
      • 1970-01-01
      • 1970-01-01
      • 2021-08-22
      • 2020-06-23
      • 2021-05-10
      • 1970-01-01
      相关资源
      最近更新 更多