【问题标题】:Load denied by X-Frame-OptionsX-Frame-Options 拒绝加载
【发布时间】:2013-11-05 17:54:38
【问题描述】:

我在自己的服务器中有一个视频池,另一家公司正在他们开发的视频播放器中为我提供 geoloc 服务。问题是我正在尝试像这样加载我的提供者的简单 iframe:

<iframe src="http://myvideoplayerprovider.com/videos/198" width="620px" height="360px" frameborder="0"></iframe>

带有视频的 iframe 在 Chrome 和 Safari 中显示没有问题。但是在 Firefox 中,控制台给了我这个错误,并且没有在浏览器上显示任何内容:

Load denied by X-Frame-Options: https://www.mydomain.com/ does not permit framing by http://subdomain.mydomain.com/gala8-foo/.

我在我的 htaccess 中尝试了 X-Frame-Options 没有成功,还有这个 php 行,没有任何改变:

<? header('X-Frame-Options: GOFORIT'); ?>

其他想法?

【问题讨论】:

  • GOFORIT 不是标头的有效值。试试`ALLOW-FROM subdomain.mydomain.com
  • 我可以在右侧的相关边栏中看到一些类似标题的问题----&gt;。好用吗?
  • 我告诉过你“我已经尝试过 X-Frame-Options,这包括 ALLOW-FROM 选项(顺便说一句,当我尝试它时,该站点检索到我的内部服务器错误)。我也看看这个你标记为“正确的”的文档。我提出这个问题是因为我还没有找到解决方案,而不是让我的朋友不高兴。
  • 您不能将http://myvideoplayerprovider.com 包含在您的网站中的 iframe 中,因为该网站启用了 X-Frame-Options。如果您向我们展示确切的 iframe 代码和确切的错误,我们可以验证这一点。您上面的示例不一致/不准确,因为您尝试 iframe 的站点与被阻止的站点不同。 owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet

标签: php firefox iframe


【解决方案1】:

将此添加到 web.xml 以用于(两个)应用程序

  <context-param>
    <description>Security precaution to prevent clickjacking: bust frames if the ancestor window domain(protocol, host, and port) and the frame domain are different. Another options for this parameter are always and never.</description>
    <param-name>org.apache.myfaces.trinidad.security.FRAME_BUSTING</param-name>
    <param-value>never</param-value>
  </context-param> 

【讨论】:

    猜你喜欢
    • 2013-02-01
    • 2014-09-06
    • 2015-11-09
    • 2015-06-04
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 2014-11-14
    • 2014-08-06
    相关资源
    最近更新 更多