前端集合 - 关注前端技术和互联网免费资源

关注前端技术和互联网免费资源

分类儿

页面儿

搜索儿

前端集合 RSS订阅
Home » 经验记录 » 如何解决node request时的unable to verify the first certificate错误?

如何解决node request时的unable to verify the first certificate错误?

发布者:前端集合 // 发布时间:2018-08-21 21:55:58 // 分类:经验记录 // 访问: 8,221 次 // 热度:

使用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句。

Tags: node, request, unable to verify the first certificate

细数那些买了不后悔的宝宝用品>>  << WordPress如何判断是否在第1页?
Top