Search code examples
androidangularjsazureionic-frameworkbreeze

404 not found - only from mobile device


I have an Ionic app that synchronises data via a webapi hosted on Azure.

I have a new version of the api that I want to test before putting it live, so I created a deployment slot on Azure and uploaded the new webapi to the new slot.

When I run my synchronisation in the Ripple emulator, it works.

However, when I run it on mobile device, the http requests return a 404 not found error.

If I put the url into a browser on the device, no problem, the page correctly returns "authentication required", and if I change the url on the device to the live site, it also works.

Could there be something in the Azure configuration that returns a 404 when the request comes from a mobile device?


Solution

  • Seems you missed the whitelisting rules for Cordova. Domain whitelisting is a security model that controls access to external domains over which your application has no control. Before moving your application to production, you should formulate a whitelist and allow access to specific network domains.

    First, you should install Cordova whitelist plugin(I think you already have it), then add the following lines that are configured to allow access to any site to AppName/config.xml file.

    <allow-navigation href="*" />
    <allow-intent href="*" />
    <access origin="*" />
    

    For more info, please refer to https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/.