开发者

ios app blocks outgoing requests to some domains after build

开发者 https://www.devze.com 2022-12-07 19:25 出处:网络
Wrote a react native application that uses SMS authorization, the user is asked for a phone number and sent to the server. When debugging, everything works fine, but after building the ios and adding

Wrote a react native application that uses SMS authorization, the user is asked for a phone number and sent to the server. When debugging, everything works fine, but after building the ios and adding it to testflight, requests to this domain are not sent. fetch writes an empty error, axios "request failed with status code 447". A simple POST request is sent.

In debugging, everything works, only the assembly on iOS breaks, andoid worked. Send over https, let's encrypt certificate.

fetch(apiUrl, {
      method: 'POST',
      body: body,
      headers: {
        'Content-Type':
        'application/x-www-form-urlencoded;charset=UTF-8',
      },
    })
axios.post(apiUrl,{
        phone: phoneUnmasked
      })
开发者_运维百科

domain added to Info.plist

<key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
      <key>NSExceptionDomains</key>
      <dict>
        <key>localhost</key>
        <dict>
          <key>NSExceptionAllowsInsecureHTTPLoads</key>
          <true/>
        </dict>
        <key>testdomain.kz</key>
        <dict>
          <key>NSIncludesSubdomains</key>
          <true/>
          <key>NSExceptionAllowsInsecureHTTPLoads</key>
          <true/>
          <key>NSExceptionRequiresForwardSecrecy</key>
          <true/>
          <key>NSExceptionMinimumTLSVersion</key>
          <string>TLSv1.2</string>
          <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
          <false/>
          <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
          <true/>
          <key>NSThirdPartyExceptionMinimumTLSVersion</key>
          <string>TLSv1.2</string>
          <key>NSRequiresCertificateTransparency</key>
          <false/>
        </dict>
      </dict>
    </dict>
0

精彩评论

暂无评论...
验证码 换一张
取 消