如何处理nodejs客户端请求服务器出现的certificate错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/i042416/article/details/88398524

我使用nodejs提供的request module向一个https发起请求,遇到下面这个错误:

DEPTH_ZERO_SELF_SIGNED_CERT

self signed certificate

clipboard1

clipboard2

解决方案:
clipboard3

在构造http请求时,指定:
strictSSL: false, // allow us to use our self-signed cert for testing
rejectUnauthorized: false

这样就能忽略掉错误:
clipboard4

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

猜你喜欢

转载自blog.csdn.net/i042416/article/details/88398524