node https请求时self signed certificate in certificate chain错误

node业务中调用https请求时,经常都会爆出一个异常的错误,查了一下是证书过期,但是axios已经设置了忽略证书了,还是报错:

 最后在网上找到方法,在请求代码之前加上

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

解决了当前https报的self signed certificate in certificate chain问题。

posted @ 2019-11-12 14:33  纸鸢&红豆·绿豆  阅读(21095)  评论(1编辑  收藏  举报