I had to use cordova-plugin-advanced-http
and change my code so I could do this.http.setSSLCertMode('nocheck');
until I can get the final certificate so I can do SSL Pinning.
This is how I changed my code.
Angular HTTP:
postData(data, object, type) {
return new Promise((resolve, reject) => {
var headers = new Headers();
headers.append('Access-Control-Allow-Origin' , '*');
headers.append('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
headers.append('Accept','application/json');
headers.append('content-type','application/json');
let options = new RequestOptions({headers:headers});
this.http.post(url, data, options)
.subscribe(res => {
resolve(res.json());
}, (err) => {
reject(err);
});
});
}
to
Cordova/Ionic Native HTTP:
postData(data, object, type) {
return new Promise((resolve, reject) => {
//Don't check SSL Certificate
this.http.setSSLCertMode('nocheck');
this.http.setHeader('*', 'Access-Control-Allow-Origin' , '*');
this.http.setHeader('*', 'Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
this.http.setHeader('*', 'Accept','application/json');
this.http.setHeader('*', 'content-type','application/json');
//Important to set the data serializer or the request gets rejected
this.http.setDataSerializer('json');
this.http.post(url, data, {}).then(res =>{
resolve(JSON.parse(res.data));
})
.catch(err =>{
reject(err);
});
});
}
This allowed the HTTPS POST requests to work in the release build