Skip to content

Trust your CA in Node.js

Richard Crowley edited this page Apr 13, 2014 · 2 revisions
var httpsAgent = new https.Agent({
        ca: fs.readFileSync('etc/ssl/certs/root-ca.crt')
      , rejectUnauthorized: true
    })
https.request(
    {
        agent: httpsAgent
      , hostname: 'example.com'
      , method: 'GET'
      , path: '/'
    }
  , function (response) {
        // ...
    }
)