【问题标题】:Computer blocks the display of an iframe计算机阻止 iframe 的显示
【发布时间】:2021-04-25 17:55:15
【问题描述】:

我和我的公司开发了一项由两个 Web 应用程序组成的服务:

  • 一个协作平台(以下称为平台),可通过类似于 online.contoso.com 的地址访问,用 ASP.NET 和 React 编写,在 Windows Server 2016 服务器上运行。该平台对用户进行身份验证和授权,并允许他们执行各种操作;
  • 一个 Web 应用程序(以下称为 App),可通过类似于 online.contoso.com:44312 的地址访问,用 Django 和 jQuery 编写,运行在同一个以前的服务器上;

Platform 通过以下 iframe 公开 App:

<iframe src="https://online.contoso.com:44312?lng=en" id="PlanningFrameId" width="100%" height="645px" style="display: block; border: 0px;"></iframe>

应用使用以下 Content-Security-Policy:

Content-Security-Policy: frame-ancestors 'self' *.contoso.com online.contoso.com

我们的一些客户声明他们无法加载应用程序。例如,今天我们的两个客户声明一个可以看到应用程序,另一个不能。这两个用户使用相同的互联网连接,但使用两台不同的计算机(均为 Mac)。未看到应用程序的客户已对 Safari 和 Google Chrome 进行了检查。计算机有什么理由可以阻止某些 iframe(Mac 和 Windows)?

我们已经在平台和应用程序上进行了测试,应用程序正常工作。

谢谢

【问题讨论】:

    标签: iframe port firewall content-security-policy


    【解决方案1】:

    奇怪的不是应用程序在某些 PC 上无法运行,而是在某些 PC 上可以运行。

    *.contoso.com 主机源允许 https://*.contoso.com:443 在 https: 页面上并允许 http://*.contoso.com:80 在 http: 页面上(默认情况下仅允许 standard ports)。

    因此您必须将https://online.contoso.com:44312 源添加到策略中:
    Content-Security-Policy: frame-ancestors 'self' *.contoso.com https://*.contoso.com:44312

    注意:online.contoso.com 过度,因为它被*.contoso.com 覆盖。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多