8

I've been using https://github.com/mikeal/request to make calls to a REST API

When I make a GET request over HTTPS with { strictSSL: false } specified in the options. I get the response I'm after and all is fine.

However, If I make a POST request also with strictSSL specified I receive an error SELF_SIGNED_CERT_IN_CHAIN

Here an example of what I've been using:

request.post({url: url, headers: headers, strictSSL: false}, function (err, response, body) {


});

Does any body know why it works for GET requests and no POST

Steven Burrows
  • 116
  • 1
  • 6
  • 3
    I tried this locally with a https server created using a self-signed certificate (using node's `https` package), and both the GET and POST requests work the same -- both returning the data if I specify the `strictSSL: false` option. Maybe there's something else going on here? You might try to isolate this by attempting to build a simple example to test it. – dylants Jun 12 '14 at 18:28
  • You should search it first https://stackoverflow.com/questions/10888610/ignore-invalid-self-signed-ssl-certificate-in-node-js-with-https-request – maicss Aug 21 '17 at 07:38

1 Answers1

5

One option that is useful when using self signed certs is to set the following environment variable:

export NODE_TLS_REJECT_UNAUTHORIZED=0

Damo
  • 5,698
  • 3
  • 37
  • 55