kWeglinski
kWeglinski

Reputation: 411

Node.js server + SSL = ERR_CONNECTION_CLOSED

I've got an node.js app which was running perfectly on http. Then I added self-signed cert to buildup and test ssl connection. When it worked out (with chrome notify that somebody could steal something) I bought the ssl cert from local certifier.

When I put the new cert server starts up normally but the browser says: Error code: ERR_CONNECTION_CLOSED

Now what could be the reason?

 https          = require('https'),
 fs             = require('fs');
var keys_dir = "./ssl/"
var sslOptions = {
    key   : fs.readFileSync(keys_dir + 'server.key'), 
    cert : fs.readFileSync(keys_dir + 'certificate.crt'),
    ca: [fs.readFileSync(keys_dir + 'nazwa1.crt'), fs.readFileSync(keys_dir +'nazwa2.crt')]
};
https.createServer(sslOptions, app).listen(app.get('port'), function(){ *** });

the port is 443. Key is RSA PRIVATE KEY. Cert is based on it.

Node -v v0.10.25

Upvotes: 4

Views: 4659

Answers (1)

kWeglinski
kWeglinski

Reputation: 411

Well I fixed it: I did check md5 of key and cert and they were different. So i recreated cert and all went nice and smooth.

Upvotes: 1

Related Questions