如何解决node request时的unable to verify the first certificate错误?
使用node request访问https网页时,报错如下:
unable to verify the first certificate
怎么解决呢?
request(url, {
timeout: 10000,
pool: false,
strictSSL: false,
rejectUnauthorized: false,
headers: {
'User-Agent': 'xxx'
}
}, function (err, res, body) {
if (err) throw err;
console.log(body);
});
重点是 strictSSL 和 rejectUnauthorized 这2句。