收到错误 Refused to display 'http://www.asp.net/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' with iframe-resizer

Getting the error Refused to display 'http://www.asp.net/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' with iframe-resizer

我正在使用 iframe-resizer 做一些 URL 掩蔽。 我使用 ASP.NET MVC5 的 Visual Studio 模板创建了一个 Web 应用程序作为 iframe 的来源,并创建了一个只有一个 HTML 页面的网站来托管我的 iframe。 屏蔽域位于 http://bitmake.azurewebsites.net/ and it needs to be an ASP.NET site. The site that have the iframe is hosted at http://desenv.bitmake.tecnologia.ws/,可以是 windows 或 linux。 我拥有这两个域并且可以管理它们。 一切都很好,我单击的所有 link 工作正常,除了当我单击重定向到另一个域 (http://www.anotherwebpage.com) 的 link 时。 阅读文档我看到这是解决这个问题的一个选项,checkOrigin 初始化选项,所以我像这样初始化调整器

 iFrameResize({
        log: true,
        checkOrigin: false,
        inPageLinks: true
    });

但我仍然收到错误消息。您可以在 F12

查看

正在阅读 this SO question 我看到它可以是来自文件 Global.asax 的源站点 (bitmake.azurewebsites.net) 中的 "workarounded"。我将 Global.asax 更改为 "AllowAll" 选项,但它仍然无法正常工作

asp.net 服务器配置为不允许 iframimg。

https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options

鉴于您无法控制远程域,您唯一的选择是代理它并删除 header。但是,鉴于服务器所有者不想出现在您的 iFrame 中,这可能会违反版权法。