Last updated: Apr 5, 2024
Reading time·2 min
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 29264261692936:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:
http
instead of https
Update your URL to use http
instead of https
.
# ⛔️ Incorrect (uses https) https://localhost:3456/articles # ✅ Correct (uses http) http://localhost:3456/articles
https
protocol, so you have to set the protocol to http
instead.Here is a simple Express.js server to reproduce the error.
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.
Error: write EPROTO 29264261692936:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:
However, if I make a POST request to http://localhost:3456/articles
(note
http
protocol), I get a 200 OK response back.
The error often occurs when making HTTP requests to APIs in Postman.
Make sure to set the protocol to http
and not https
.
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.
// 👇️ Uses http protocol const instance = axios.create({ baseURL: 'http://api.example.com' });
You can learn more about the related topics by checking out the following tutorials: