When downloading software packages, testing REST APIs, or automating web deployments in the Linux terminal, executing a curl command occasionally terminates with the cryptic OpenSSL error: curl: (35) error:0A00010B:SSL routines::wrong version number (or in older OpenSSL releases, error:1408F10B:SSL routines:ssl3_get_record:wrong version number). Even though curl initiates the network connection, OpenSSL aborts during TLS record decoding. This error occurs because the curl client attempted an encrypted TLS/SSL handshake against a server port that is expecting plaintext HTTP or a non-SSL protocol.
Why Does curl Throw Error 35: Wrong Version Number?
The error is an architectural mismatch between encryption protocols and port targets:
- HTTPS Query to Plaintext HTTP Port: Specifying
https://example.com:8080when the backend service (such as Node.js, Tomcat, or Docker) on port 8080 is listening exclusively for unencrypted HTTP traffic. - Misconfigured Environment Proxy Variables: Environment variables (such as
http_proxyorhttps_proxy) configured with anhttps://scheme when the corporate proxy listener only accepts plainhttp://CONNECT tunnels. - Reverse Proxy SSL Termination Misalignment: Nginx or Apache reverse proxies forwarding incoming TLS requests to internal upstream servers without stripping the SSL layer.
- Firewall or Captive Portal Interception: Local Wi-Fi captive portals or corporate packet inspection gateways intercepting port 443 and returning a plaintext HTML 302 redirect.
Step 1: Check the URL Protocol and Port Assignment
Verify whether the target endpoint is expecting plaintext HTTP rather than HTTPS.
- Examine your curl command line. If querying custom ports (such as 8080, 8000, 3000, 5000), test the plaintext HTTP protocol instead:
# Instead of: curl https://localhost:8080 curl http://localhost:8080 - If the remote server serves HTTPS on a non-standard port, confirm with
-v(verbose) flag to inspect initial server banner responses:curl -v https://your-server.local:8443 - If the initial server response starts with
HTTP/1.1 400 Bad Requestor plaintext HTML, the server port is definitively plaintext.
Step 2: Inspect and Fix Proxy Environment Variables
Misconfigured proxy declarations in /etc/environment or ~/.bashrc frequently trigger SSL error 35.
- Check active proxy variables in your current shell:
env | grep -i proxy - If
https_proxyis set to an HTTPS URL pointing to a plaintext proxy (for example,https_proxy=https://proxy.corp.local:3128), change the proxy protocol scheme tohttp://:export https_proxy="http://proxy.corp.local:3128" export http_proxy="http://proxy.corp.local:3128" - To test your curl request without any proxy interference, bypass proxies explicitly:
curl --noproxy "*" -v https://api.example.com
Step 3: Test Direct TLS Handshake Using OpenSSL s_client
Isolate whether the target server port supports TLS encryption protocols.
- Use OpenSSL’s diagnostic diagnostic client to probe the endpoint:
openssl s_client -connect target-host:port - If the command outputs a certificate chain and ends with
Verify return code: 0 (ok), the server supports TLS properly. - If it outputs
CONNECTED(00000003)followed immediately byerror:0A00010B:SSL routines::wrong version number, the service listening on that port is definitively not an SSL/TLS server. Update your backend server configuration or change the curl target URL.