Curl returns "Unknown protocol" Curl returns "Unknown protocol" curl curl

Curl returns "Unknown protocol"


Although it is not the case of the OP, the error "Unknown protocol" in cURL appears when you accidentally trying to call HTTP server using HTTPS, usually during local development.
Just mentioning it in case someone Googles this error and lands here.

curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol


I had this issue with curl as well, and it turns out I had a problem with my environment variables.

Normally, you can specify the proxy using http_proxy and https_proxy environment variables, but I was accidentally using the wrong value for https_proxy.

In my case, I had:

http_proxy=http://a.b.c.d:3128/https_proxy=https://a.b.c.d:3128/

This was wrong, because (in my case at least) the https_proxy should not be using the HTTPS protocol, it should be the same as the http_proxy. Once I set both proxy environment variables to use only http://a.b.c.d:3128/ everything worked again.

So, in case this helps others, try:

http_proxy=http://a.b.c.d:3128/https_proxy=http://a.b.c.d:3128/ # NOT HTTPS


Also an answer here: node-request - Getting error "SSL23_GET_SERVER_HELLO:unknown protocol"

Your server is using outdated SSLv2... you could try this as it is in the man pages:

curl https://localhost/api/v1/status --verbose --sslv2