A solution to disable to verify the first certificate when using request in nodejs

Today a crawler hung up, and the test found an error: unable to verify the first certificate

Here is an effective solution, reference: https://www.reddit.com/r/node/comments/7vyc2q/cant_get_https_request_with_certificate_to_work/

reference:

strictSSL - if true, requires SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that CA as an option.

https://www.npmjs.com/package/request

Just add a parameter to the request:

strictSSL: false
That's it.
 

Guess you like

Origin www.cnblogs.com/mrlonely2018/p/12746223.html