node-request - Getting error "SSL23_GET_SERVER_HELLO:unknown protocol"

I'm using the node-request module, regularly sending GET requests to a set of URLs and, sometimes, getting the error below on some sites.

Error: 29472:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:683

The problem is that I don't get this error always or always on the some URLs, just sometimes. Also, it can't be ignored with "strictSSL: false".

I have read that this can be related to me sending SSL requests with the wrong protocol (SSLv2, SSLv3, TLS..). But this doesn't explain why it happens irregularly.

Btw, I'm running nodejs on a Win 2008 server.

Any help is appreciated.


Solution 1:

You will get such error message when you request HTTPS resource via wrong port, such as 80. So please make sure you specified right port, 443, in the Request options.

Solution 2:

This was totally my bad.

I was using standard node http.request on a part of the code which should be sending requests to only http adresses. Seems like the db had a single https address which was queried with a random interval.

Simply, I was trying to send a http request to https.

Solution 3:

I got this error because I was using require('https') where I should have been using require('http').