Error: write EPROTO error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
2 min

banner

# Error: write EPROTO error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER

The "Error: write EPROTO error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER" occurs when you issue a POST request using https as the protocol when the API only supports http.

To solve the error, update the protocol to http if your API only supports http.

error write eproto ssl routines openssl internal

shell
Error: write EPROTO 29264261692936:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:

# Update your URL to use http instead of https

Update your URL to use http instead of https.

shell
# ⛔️ Incorrect (uses https) https://localhost:3456/articles # ✅ Correct (uses http) http://localhost:3456/articles
The API you are making an HTTP request to likely doesn't support the https protocol, so you have to set the protocol to http instead.

Here is a simple Express.js server to reproduce the error.

index.js
const express = require('express'); const app = express(); app.post('/articles', function requestHandler(req, res) { res.end('bobbyhadz.com'); }); const port = 3456; app.listen(port, () => { console.log(`Example app listening on port ${port}`); });

Starting the server with node index.js and making a POST request to https://localhost:3456/articles causes the following error.

shell
Error: write EPROTO 29264261692936:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:

specifying https protocol causes the error

However, if I make a POST request to http://localhost:3456/articles (note http protocol), I get a 200 OK response back.

http protocol success response

# Making HTTP requests to APIs in Postman

The error often occurs when making HTTP requests to APIs in Postman.

Make sure to set the protocol to http and not https.

When making HTTP requests to a server hosted on localhost, you don't have to use the https protocol.

If you have a custom axios instance, make sure you aren't setting the baseURL property to a URL that has the https protocol.

index.js
// 👇️ Uses http protocol const instance = axios.create({ baseURL: 'http://api.example.com' });

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.