带有 s3.amazon.com 的 iOS9 NSAppTransportSecurity

标签 ios django ssl amazon-s3 ios9

我正在 iOS9 中测试一个应用程序,并在 ATS 从 amazon.com 加载图像时遇到 SSL 错误。我所有的东西都通过 https 传送,但我仍然遇到问题。

我已经添加了正确的 ATS key (在另一个应用程序上工作)。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>amazonaws.com</key>
        <dict>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

我在论坛、adc 和 SO 上到处都是,但我没有任何运气。

我已经尝试完全删除 ATS,但我仍然遇到同样的错误。

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

错误:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey={type = immutable, count = 3, values = ( 0 : 1 : 2 : )}, NSUnderlyingError=0x7ffe70e2c690 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=https://redacted.s3.amazonaws.com/14B78421-84F1-48D1-A8F4-73B688102EE7-21502-00003598C1B6C883_thumbnail.jpg, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, kCFStreamPropertySSLPeerCertificates={type = immutable, count = 3, values = ( 0 : 1 : 2 : )}, _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://redacted.s3.amazonaws.com/14B78421-84F1-48D1-A8F4-73B688102EE7-21502-00003598C1B6C883_thumbnail.jpg, _kCFStreamErrorCodeKey=-9802}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://redacted.s3.amazonaws.com/14B78421-84F1-48D1-A8F4-73B688102EE7-21502-00003598C1B6C883_thumbnail.jpg, NSErrorFailingURLStringKey=https://redacted.s3.amazonaws.com/14B78421-84F1-48D1-A8F4-73B688102EE7-21502-00003598C1B6C883_thumbnail.jpg, NSErrorClientCertificateStateKey=0}

静态文件:AWS亚马逊
主持人:Heroku
后端:Django
API:Django Rest 框架

我已经尝试了我能在 ATS 上找到的所有配置、清理/重置/重建、修改 Django 请求(最初它们包括查询字符串身份验证)等。我对此感到困惑并被阻止。

最佳答案

在我对 https 链接进行子字符串替换之后——我收到消息说 ATS 正在阻止它们。我知道我在 Info.plist 中有正确的 key - 所以我认为它必须是某个地方的另一个 Info.plist。

事实证明,资源中有一个 Info.plist,但它什么也没做。我们必须将 ATS 键添加到目标面板上的信息选项卡。不是 100% 确定这两者有什么区别,因为我过去一直编辑 Info.plist。

关于带有 s3.amazon.com 的 iOS9 NSAppTransportSecurity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32660670/

相关文章:

ios - cordova cordova-plugin-statusbar StatusBarOverlaysWebView 不工作

android - "CopyAndConvertResources"任务意外失败(只读资源)

ios - 带有全大写键盘的 UIKeyInput

Django、mozilla-django-oidc 和管理员

django - Solr 搜索问题

ssl - 在 Wildfly 10 上保护 activemq

ssl - 如何使用 https haproxy 检查后端服务器的运行状况

c# - 如何将 confluent-kafka 与 key 存储文件一起使用

ios - 系统.Net.WebException : An SSL error has occurred and a secure connection to the server cannot be made

django - 使用 LESS/SCSS 的每用户配色方案?