2017-08-06 85 views
0

我尝试连接到https上部署的nodejs服务器上的其余api。 我在我的服务器上安装了自签名证书。appcelerator连接到nodejs https REST

我不明白在httprequest中配置我的certifcat的appcelerator文档。只有https模块的文档。 http://docs.appcelerator.com/platform/latest/#!/api/Modules.Https

只适用于专业订阅O_o该死!我必须有钱才能安全? ;)

下面是代码:

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(); 

答案:

此服务器的证书无效。您可能会连接到假装为“xx.xx.xx.xxx”的服务器,这可能会使您的机密信息处于危险之中。

感谢您的帮助!

回答

0

此问题不是Appcelerator Titanium或任何其他移动解决方案所特有的。问题是你的证书。尝试使用像Cloudflare(免费)https://www.cloudflare.com/这样的东西来获得安全的SSL连接,而不是像这样的自签名证书。

+0

我已经安装了一个有效的证书,但现在问题是“服务器不存在” – KbZuhn