CoolAJ86's solution is correct, and it does not reduce your security, like disabling all checks with rejectUnauthorized or NODE_TLS_REJECT_UNAUTHORIZED . However, you may need to enter an additional CA certificate explicitly.
I tried first the root CAs included in the ssl-root-cas module:
require('ssl-root-cas/latest') .inject();
I still ended up with UNABLE_TO_VERIFY_LEAF_SIGNATURE error. Then I found out who issued the certificate for the website with which I connected COMODO SSL Analyzer , uploaded the certificate of this authority and tried to add only one:
require('ssl-root-cas/latest') .addFile(__dirname + '/comodohigh-assurancesecureserverca.crt');
I ended up with another error: CERT_UNTRUSTED . Finally, I introduced additional root CAs and turned on my (obviously, intermediary) CA, which worked:
require('ssl-root-cas/latest') .inject() .addFile(__dirname + '/comodohigh-assurancesecureserverca.crt');
Ferdinand Prantl Aug 31 '14 at 10:52 2014-08-31 10:52
source share