Allow HTTPS connections with self-signed certificates

Hi,

I am creating an ionic app which uses HTTPS. The application will be used in an isolated environment which means it will have no internet connection. The SSL certificate will be self-signed or issued by an internal Certificate Authority.

Currently in the release build, the HTTPS connections will abort even after installing the certificate as a user certificate.

We are using Angular HttpClient to do the requests and running the app on Nougat (v7) and above.

What is the correct way to resolve this issue?

Thanks,

Andrew

1 Like

I am facing the same problem in ionic v4. I have changed the Network security configuration using Cordova to the following:

<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
        <certificates src="user" />
    </trust-anchors>
</base-config>

This should lead to user certificates to be included since in the default config(> Android 7.0 (API level 24) see here) they are not included. But still, my https request fails. Using chrome I can access the corresponding site which uses the same certificate. The certificate is installed as a user certificate in android but does not seem to get to the angular HTTP client.

My configuration:
“cordova-android”: “7.1.1”,
@ionic/angular”: “^4.1.0”,
@angular/http”: “^7.2.2”

Ionic info

Ionic:

ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.4.2
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 14 other plugins)

System:

NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

My solution seems to work now. I think I caching issues before. Can be closed.