ERR_SSL_PROTOCOL_ERROR - Socket.io and Node.js

Asked

Viewed 725 times

2

I am running a Node.js server using Socket.io to manage connections via Socket, but I am having a problem with SSL certificates. Most users can access the Node.js server normally, but others cannot and receive the following error:

Erro exibido aos usuários

When I set up my server, I have the following SSL options:

var privateKey = fs.readFileSync('/root/cert/key.key', 'utf8').toString();
var certificate = fs.readFileSync('/root/cert/cert.crt', 'utf8').toString();
var ca = fs.readFileSync('/root/cert/ca.crt').toString();
var credentials = { key: privateKey, cert: certificate, ca: ca };
var app = express();
var httpsServer = https.createServer(credentials, app);
var io = require('socket.io')(httpsServer);

Does anyone know how to fix this error? What problem is the fact that only a few users have this error.

Thank you in advance!

  • Please add your client code.

1 answer

-1

Explicitly tries to put SSL security on the client side:

var socket = io.connect('https://localhost:PORTA', {secure: true});

Checks if you are using https on the client side

Browser other questions tagged

You are not signed in. Login or sign up in order to post.