aacerox / node-rest-client

REST API client from node.js
MIT License
377 stars 132 forks source link

how to ignore invalid ssl certificate and proceed forward #162

Closed rajashekhargundeti closed 7 years ago

rajashekhargundeti commented 7 years ago

Hi, I'm getting the following error while connecting to a site having invalid certicate. Error: unable to get local issuer certificate.

Please let me know how to ignore this and proceed with this.

-- Raja

Senseye commented 7 years ago

Quick fix, add this line before making a request: process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

rajashekhargundeti commented 7 years ago

Thank you, i know this fix. it doesn't solve this problem as the piece of code is running on a webserver, contacting an outside API to pull and push the data. I dont wish to change this at nodejs process level.

--Raja

On Thu, May 25, 2017 at 7:14 PM, Sergiu notifications@github.com wrote:

Quick fix, add this line before making a request: process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aacerox/node-rest-client/issues/162#issuecomment-304013595, or mute the thread https://github.com/notifications/unsubscribe-auth/ALREpC6xkQWgFKK3t-tiXCL0XmJm9-Bzks5r9YXbgaJpZM4NmQIj .

rajashekhargundeti commented 7 years ago

Had gone through all the code.

The following statement made this possible:

var c = new Client({connection: {rejectUnauthorized: false}});