【问题标题】:Cordova whitelist iOS 10 SSL error: Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be madeCordova 白名单 iOS 10 SSL 错误:无法加载资源:发生 SSL 错误,无法与服务器建立安全连接
【发布时间】:2017-01-22 21:56:15
【问题描述】:

我正在尝试发送一个 ArrayBuffer 到

https://1511921174.cloud.vimeo.com/upload?ticket_id=xxxxxxxxxx&video_file_id=xxxxxx&signature=xxxxxxxx=1%22

在 iOS 10 中什么都没有发生。我必须有一个白名单错误。我根据 cordova-plugin-whitelist 文档将 *.vimeo.com 和 *.cloud.vimeo.com 列入白名单。在 iOS 9 和 Android 上一切正常。

<access origin="http://*.vimeo.com" subdomains="true" />
<access origin="https://*.vimeo.com" subdomains="true" />
<access origin="http://*.cloud.vimeo.com" subdomains="true" />
<access origin="https://*.cloud.vimeo.com" subdomains="true" />

任何想法可能会发生什么? 谢谢!

【问题讨论】:

    标签: ios cordova vimeo whitelist


    【解决方案1】:

    在我在 config.xml 中添加带有 edit-config 标记的 Info.Plist 条目之前。 但是由于一个模糊的原因,当我覆盖 NsAppTransportSecurity 条目时它不起作用。

    经过一些研究,我发现,自 2015 年 10 月以来,cordova-plugin-whitelist 还将 config.xml 中的“access”和“allow-navigation”标签转换为 Info.Plist 文件中的 NsAppTransportSecurity 条目(@987654321 @)。

    所以插件阻止了我的 config.xml 中的 edit-config 标记覆盖此条目。 根据 Cordova 的this doc,您可以在 config.xml 的“access”和“allow-navigation”标签中设置传输安全选项。 我这样做了,现在效果很好。

    【讨论】:

      【解决方案2】:

      看起来这不是白名单,而是应用传输安全问题。

      我使用 iOS 10 将视频上传到 Vimeo。看起来 Vimeo 的 SSL 证书可能存在问题。他们可能使用旧的 TLS 版本。当我在 plist 中关闭 App Transport Security 时,它就起作用了:

      <key>NSAppTransportSecurity</key>
      <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
      </dict>
      

      所以在没有关闭所有内容的情况下,我最终只在 vimeo.com 的 plist 中添加了以下代码:

      <key>NSAppTransportSecurity</key>
      <dict>
          <key>NSExceptionDomains</key>
          <dict>
              <key>vimeo.com</key>
              <dict>
                  <key>NSExceptionAllowsInsecureHTTPLoads</key>
                  <true/>
                  <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
                  <true/>
                  <key>NSExceptionRequiresForwardSecrecy</key>
                  <false/>
                  <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                  <false/>
                  <key>NSIncludesSubdomains</key>
                  <true/>
                  <key>NSExceptionMinimumTLSVersion</key>
                  <string>TLSv1.0</string>
                  <key>NSRequiresCertificateTransparency</key>
                  <false/>
              </dict>
          </dict>
      </dict>
      

      希望对大家有所帮助。

      【讨论】:

      • 唯一让它对我有用的东西......我可以发誓我之前把它放进去,但它显然没有保存......我想我必须直接使用文本编辑 plist 文件编辑器而不是 xcode。
      【解决方案3】:

      我必须对 iOS 10 (see here) 的 Content-Security-Policy 元标记进行调整,因此您可能还需要添加/更新它,例如

      <meta http-equiv="Content-Security-Policy" content="default-src 'self' gap: file: https://*.cloud.vimeo.com; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; media-src *">
      

      【讨论】:

      • 感谢您的评论。我将您的代码添加到我的 CSP 中,但没有帮助。
      猜你喜欢
      • 2019-06-26
      • 2020-11-02
      • 2016-02-28
      • 2015-12-21
      • 2018-06-06
      • 2013-10-11
      • 2012-07-25
      • 2018-08-27
      • 1970-01-01
      相关资源
      最近更新 更多