更新时间:2022-03-19 23:26:44
我在使用官方而非自签名证书时遇到了类似的问题,我刚刚找到了解决方案.顺便说一句,它仅在 Android 上的 chrome 中失败了.将证书链添加到 https.createServer 方法的选项对象中:
I had a similar issue when using an offical, not self signed certificate and I just found the solution. It only failed in chrome on Android, btw. Add the certifate chain to the options object of the https.createServer method:
var hskey = fs.readFileSync('/the_key.key');
var hscert = fs.readFileSync('/the_cert.pem')
var ca = fs.readFileSync('/The_CA_bundle.pem')
var credentials = {
ca:ca,
key: hskey,
cert: hscert
};
var server = https.createServer(credentials,app).listen(app.get('port'), function(){
console.log("Express server listening on port with https " + app.get('port'));
});
把它放在这里,以防止其他人在遇到类似问题时用头撞墙.
Just putting it here, to prevent someone else banging his head against the wall when having a similar issue.