ERR_CERT_COMMON_NAME_INVALID on call to web service


#1

I’m trying to run an Ionic v3 App locally. It has to call a webservice which is running on a local IIS web server. The request is HTTPS and a self signed certificate is installed for the ‘default’ site under which the targeted web site runs.

I constantly get the error ERR_CERT_COMMON_NAME_INVALID which I think means the server does not accept the self signed certificate.

I’ve tried to use the trustUnsecureCert(true) solution but can’t get that to work. I don’t even understand how I should implement this in typescript for Ionic and documentation is sparse.

My package.json is below:

{
“name”: “Wur.P2G.StartStop”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“start”: “ionic-app-scripts serve”,
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”
},
“dependencies”: {
@angular/animations”: “5.2.11”,
@angular/common”: “5.2.11”,
@angular/compiler”: “5.2.11”,
@angular/compiler-cli”: “5.2.11”,
@angular/core”: “5.2.11”,
@angular/forms”: “5.2.11”,
@angular/http”: “5.2.11”,
@angular/platform-browser”: “5.2.11”,
@angular/platform-browser-dynamic”: “5.2.11”,
@ionic-native/core”: “~4.17.0”,
@ionic-native/http”: “^4.17.0”,
@ionic-native/splash-screen”: “~4.17.0”,
@ionic-native/status-bar”: “~4.17.0”,
@ionic-native/streaming-media”: “^4.17.0”,
@ionic/storage”: “2.2.0”,
“cordova-android”: “7.1.4”,
“cordova-plugin-advanced-http”: “2.0.1”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-file”: “^6.0.1”,
“cordova-plugin-ionic-keyboard”: “^2.1.3”,
“cordova-plugin-ionic-webview”: “^2.2.5”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-streaming-media”: “2.2.0”,
“cordova-plugin-whitelist”: “^1.3.3”,
“ionic-angular”: “3.9.2”,
“ionicons”: “3.0.0”,
“rxjs”: “5.5.11”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.26”
},
“devDependencies”: {
@ionic/app-scripts”: “3.2.0”,
“typescript”: “~2.6.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-advanced-http”: {},
“cordova-plugin-streaming-media”: {},
“cordova-plugin-whitelist”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-ionic-webview”: {
“ANDROID_SUPPORT_ANNOTATIONS_VERSION”: “27.+”
},
“cordova-plugin-ionic-keyboard”: {}
},
“platforms”: [
“android”
]
}
}


#2

Hi @PaulSinnema,

Yes, the problem is the SSL certificate on the web server. Since Ionic runs in a browser (or webview) you will have to get this fixed to be able to call the web service.

Best,
Rodrigo