Cordova-plugin-whitelist problem only in release

I have a problem with the cordova Whitelist plugin.
It works well in debug mode (ionic build android).
But in release mode (ionic build --release android), my app can’t reach my rest api.

I’ve set <access origin="*" /> in the config.xml.
<meta http-equiv="Content-Security-Policy" content="default-src 'self' *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">
in index.html

I’ve tried lots of things and nothing works… And same problem for ios build…
Have you ever get this issue ?


I am having the exact same problem and I’ve tried everything to no avail. I am very frustrated and completely stuck! I cannot create a build to upload to the play store that will actually work.

I does seem to be a problem with whitelist plugin which I have reinstalled several times. Please please can anybody give some insite into this?

When I call $http I get a return with a result code of just “0” which doesn’t help pinpoint the issue…

I don’t know if you got a solution with this problem, but I got the same issue and came to a solution.

The “0” means that the browser didn’t get an answer from the server. In this kind of application, the cause could be the whitelist plugin and its bad configuration. First of all you have to check this, in my case it wasn’t.

The issue is from the fact that the SSL is not good enough. To be more specific, if you go to the URL through a browser. On desktop you will never get the issue and the same come with iOS. But with android policy, you will get a message like “Your connection is not private”. That’s why we get a status 0 through the $http requests.

With that thing in my mind, I googled and I found this post : ssl-certificate-is-not-trusted-on-mobile-only

So, I checked the SSL using this website :
I found that the intermediate certificate was in SHA1 and it’s deprecated.

I Hope this can help you.

EDIT : After changing the intermediate certificate with another one (SHA2 instead of SHA1), I don’t have this issue anymore.

You can read these articles and get the solution…