Node.js Rest call to a server that requires a certificate
问题 How do a make a rest call from Node.js to a server that requires a certificate for authentication? 回答1: The solution is to use a custom connection pool, for which you'll need to use a custom Agent. Here's an example using the standard https module, straight from the documentation: var options = { hostname: 'encrypted.google.com', port: 443, path: '/', method: 'GET', key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') };