How to fix missing intermediate / network certificate in nodejs

I installed nodejs and ssl on my server

and my app.js code

var sslOptions = { key: fs.readFileSync('/etc/ssl/private/private.key'), cert: fs.readFileSync('/etc/ssl/certs/cert.com.crt'), requestCert: true, ca: fs.readFileSync('/etc/ssl/certs/ca.crt'), rejectUnauthorized: false }; var secureServer = https.createServer(sslOptions,app).listen(443, function(){ console.log("Express server listening on port "); }); 

Now when i check

https://www.sslshopper.com/

he gives me an error

The certificate is not trusted in all web browsers. You may need to install an intermediate / chain certificate to associate it with a trusted root certificate. More about this error ... You can fix this by following the instructions for installing a Comodo certificate for your server platform (use these instructions for InstantSSL). Pay attention to parts about intermediate certificates.

Any idea?

How to fix it

+6
source share
1 answer

Comment out the line you are adding the ca package to. Copy all the text from ca.crt and paste them into cert.com.crt (do not replace the previous certificate, just paste it). Now it should work fine.

 var sslOptions = { key: fs.readFileSync('/etc/ssl/private/private.key'), cert: fs.readFileSync('/etc/ssl/certs/cert.com.crt'), requestCert: true, //ca: fs.readFileSync('/etc/ssl/certs/ca.crt'), rejectUnauthorized: false }; var secureServer = https.createServer(sslOptions,app).listen(443, function(){ console.log("Express server listening on port "); }); 
+13
source

All Articles