Progress will discontinue Telerik Platform on May 10th, 2018. Learn more
  • HTTP Communication Between the Mobile App and Web Service Is Not Working after Deployment

HTTP Communication Between the Mobile App and Web Service Is Not Working after Deployment

Environment

Service Code (AppBuilder)
Mobile development type Hybrid (Apache Cordova app)
Mobile OS iOS, Android
Apache Cordova framework version 4.0.0 and higher

Description

You have set the target Apache Cordova version of your app to 4.0.0 or higher. After deploying the app on an actual device the HTTP requests to a web service don't work. The web service is functioning as expected and the app runs correctly in the developer tools.

Error Message

The web service is returning error code 404 Not Found.

Cause

The HTTP transport security policy for the app (either OS-configured or developer-set) does not allow to connect to the remote service.

Solution

Rule out the server and client-side configuration and what may be the configuration that makes the request to fail. Check the following:

  • If your app is pointing to a TLS-secured endpoint check the certificate validity. More information in App Cannot Connect to a Remote Service over HTTPS When Running on Device.
  • Check if you have enabled the Apache Cordova Whitelist plugin in the PropertiesPluginsCore Plugins. More on whitelist policy in Apache Cordova-based apps here (for version 6.x.x of Cordova).
  • You have correctly set the whitelist policy of the app to allow navigation to the required protocols and URIs. More on whitelist policy in Apache Cordova-based apps here (for version 6.x.x of Cordova). More information about this in AJAX jQuery Requests Do Not Work on Android.
  • If you are using a web service over HTTP (not secured with TLS) you may add an exception in the iOS info.plist file of your app for the NSAppTransportSecurity key. You can edit the info.plist file as explained here. An example transport security exception for the server example.com:

    Communication over TLS is recommended. Consider setting the exception below only for testing and development purposes.

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSExceptionDomains</key>
      <dict>
        <key>example.com</key>
        <dict>
          <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
          <true/>
      </dict>
    </dict>
    

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.