我的WebProxy是在节点中构建的。我使用request模块从给定的Url中获取内容。当站点在浏览器中打开时,我将获得CERT_HAS_EXPIRED error for https://www.macu.com。
我的调查
我通过Chrome调查并检查了证书的详细信息,但我发现证书没有过期。我不明白这个网站的证书的问题。
我认为这可能是Node.js列表中不存在的供应商的问题。我尝试过升级npm和节点版本,但没有成功。此外,https://www.facebook.com的证书也是由DigiCert高级保证CA-3供应商颁发的,该供应商明确表示该供应商存在于Node.js CA列表中。
以下是代码:
var request = require('request');
function getContent(urlOptions) {
request.get(urlOptions, function(error, response, body) {
if (error) console.log('Error:' + error);
if (body) {
console.log('Body:' + body);
}
});
}
exports.init = function() {
var urlOptions = {
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=0.8',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36'
},
secureProtocol: 'TLSv1_method'
};
/* URL options for macu.com domain */
urlOptions.url = 'https://www.macu.com/mystyle-checking';
urlOptions.headers.host = urlOptions.headers.Host = 'www.macu.com';
// urlOptions.rejectUnauthorized = false; // Works when this option is set but it may cause security issue
getContent(urlOptions);
urlOptions.url = 'https://www.facebook.com';
urlOptions.headers.host = urlOptions.headers.Host = 'www.facebook.com';
getContent(urlOptions);
};我只想知道
发布于 2015-01-06 09:48:56
您的DigiCert High Assurance EV Root CA中级证书似乎已经过期,请参阅f.e。https://www.sslshopper.com/ssl-checker.html#hostname=www.macu.com
很可能您的浏览器没有抱怨它,因为它已经安装了一个新的、有效的中间证书版本(并使用该版本来证明签名机构的身份),而在您的节点实例中,它仍然是旧的版本(并向对应方展示了该版本)。
编辑:--进一步解释:当双方协商加密连接时,发起方将提交其证书和中间证书,以便对方验证它们。
如果您的浏览器已经将最新的中间证书DigiCert High Assurance EV Root CA存储在它自己的证书缓存中,那么它可能会使用它来验证它提供的证书。
然而,其他方面(如您的node.js模块)可能没有存储自己的中间证书,因此它们依赖于它们所呈现的内容。如果链中的一个证书过期了,那么整个证书的验证就会失败。
https://stackoverflow.com/questions/27716511
复制相似问题