Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSLv3 error when sending a request to a endpoint

I am attempting to request data from an endpoint however I am currently getting the following error. Any ideas how it can be resolved.

REQUEST: Error: write EPROTO 140735243141888:error:140943F2:SSL routines:SSL3_READ_BYTES:sslv3 alert unexpected message:../deps/openssl/openssl/ssl/s3_pkt.c:1289:SSL alert number 10

var cert = '{location to my certificate}'
var key = '{location to my key}'

var fs = require('fs')
    , request = require('request');

function authCallback (error, response, body) {
  if (!error && response.statusCode == 200) {
  console.log(response.headers);
  } else {
  console.error("REQUEST: "+error)
 };
}

var options = {
url: 'https://some.endpoint.co.uk',
agentOptions: {
    cert: fs.readFileSync(cert),
    key: fs.readFileSync(key),
    securityOptions: 'SSL_OP_NO_SSLv3'
 }
}

request.get(options, authCallback);

Many Thanks

like image 848
Akif Tahir Avatar asked Oct 28 '25 08:10

Akif Tahir


1 Answers

My problem was similar but solution is different

FetchError: request to https://test-bdo.mos.gov.pl/api/WasteRegister/WasteTransferCard/v1/Kpo/receiver/search failed, reason: write EPROTO 140695301860680:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

For some reason none of SSL related fixes solved my problem. I used some public API and problem only existed for some endpoints, so it was even more confusing.

The solution

What I did wrong - I passed headers from frontend to the backend and forwarded them to the API. Browser adds many headers, which were unnecessary here. When I limited headers to Authorization and Content-Type headers problem disappeared.

like image 158
Zydnar Avatar answered Oct 29 '25 21:10

Zydnar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!