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

Javascriptnode.jsSslRequest

Javascript Problem Overview


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.

Javascript Solutions


Solution 1 - Javascript

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 - Javascript

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 - Javascript

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

Solution 4 - Javascript

Some of the sites are speaking SSLv2, or at least sending an SSLv2 server-hello, and your client doesn't speak, or isn't configured to speak, SSLv2. You need to make a policy decision here. SSLv2 should have vanished from the face of the earth years ago, and sites that still use it are insecure. However, if you gotta talk to them, you just have to enable it at your end, if you can. I would complain to the site owners though if you can.

Solution 5 - Javascript

I had this problem (403 error for each package) and I found nothing great in the internet to solve it. My .npmrc file inside my user folder was wrong and misunderstood. I changed this npmrc line from

proxy=http://XX.XX.XXX.XXX:XXX/

to :

proxy = XX.XX.XXX.XXX:XXXX

Solution 6 - Javascript

var https = require('https');
https.globalAgent.options.secureProtocol = 'SSLv3_method';

Solution 7 - Javascript

I got this error while connecting to Amazon RDS. I checked the server status 50% of CPU usage while it was a development server and no one is using it.

It was working before, and nothing in the connection configuration has changed. Rebooting the server fixed the issue for me.

Solution 8 - Javascript

So in Short,

vi ~/.proxy_info

export http_proxy=<username>:<password>@<proxy>:8080
export https_proxy=<username>:<password>@<proxy>:8080

source ~/.proxy_info

Hope this helps someone in hurry :)

Solution 9 - Javascript

in my case (the website SSL uses ev curves) the issue with the SSL was solved by adding this option ecdhCurve: 'P-521:P-384:P-256'

request({ url, 
   agentOptions: { ecdhCurve: 'P-521:P-384:P-256', }
}, (err,res,body) => {
...

JFYI, maybe this will help someone

Solution 10 - Javascript

I got this error, while using it on my rocketchat to communicate with my gitlab via enterprise proxy,

Because, was using the https://:8080 but actually, it worked for http://:8080

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionumutmView Question on Stackoverflow
Solution 1 - JavascriptGaf KingView Answer on Stackoverflow
Solution 2 - JavascriptumutmView Answer on Stackoverflow
Solution 3 - JavascriptBenView Answer on Stackoverflow
Solution 4 - Javascriptuser207421View Answer on Stackoverflow
Solution 5 - JavascriptFlament MickaëlView Answer on Stackoverflow
Solution 6 - Javascriptuser3180229View Answer on Stackoverflow
Solution 7 - JavascriptDiaa KasemView Answer on Stackoverflow
Solution 8 - JavascriptPrateek MishraView Answer on Stackoverflow
Solution 9 - JavascriptDenisixView Answer on Stackoverflow
Solution 10 - JavascriptMohanBabuView Answer on Stackoverflow