I try to connect to my rest api on a nodejs server deployed in https. I have a self-signed certificate installed on my server.
I did not understand the appcelerator documentation to configure my certifcat in the httprequest. Only documentation for the https module. http://docs.appcelerator.com/platform/latest/#!/api/Modules.Https
Only for a pro subscription O_o damn ! I must be rich to be secure ?? ;)
Here is the code :
var xhr = Ti.Network.createHTTPClient({
validatesSecureCertificate:true,
onload: function() {
console.log(this.responseText);
var json = JSON.parse(this.responseText);
},
onerror : function(e) {
console.log(e.error);
},
timeout : 5000
});
xhr.open('GET','https://xx.xx.xx.xxx:443/test');
xhr.send();
The answer :
The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xx.xx.xx.xxx” which could put your confidential information at risk.
Thank's for help !
This issue is not unique to Appcelerator Titanium or any other mobile solution. The problem is your cert. Try using something like Cloudflare (free) https://www.cloudflare.com/ to get a secure SSL connection instead of doing it with a self-signed cert like that.