Gary Sieling

Fixing node error: 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:

If you try to make a a request in Node.js over HTTPS, you can get an error like this:

101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:

This can occur if you set the port on the URL, forcing it to communicate over a non HTTPs port.

For instance, in this example, port should be 443, or left out entirely:

var options = {
  hostname: 'gateway-a.watsonplatform.net',
  path: url + endpoint,
  port: 80,
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': postData.length
  }
};
                   
request(options, function(res) {
  ...
});
Exit mobile version