Reputation: 126
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
Upvotes: 9
Views: 9801
Reputation: 6433
One option that is useful when using self signed certs is to set the following environment variable:
export NODE_TLS_REJECT_UNAUTHORIZED=0
Upvotes: 6