How to Fix SSL Error in NodeJS

If you are trying to attach an SSL to your Node.js application but it throws errors related to the following, then try this solution.

  • Intermediate certificate error
  • Chain certificate error

Solution

A typical SSL certificate comes with 3 files

  • SSL Certificate
  • SSL Private Key
  • SSL Intermediate CA Certificate

Instead of adding all the above 3 files separately in your NodeJS application’s SSL Options/Configuration.

  • Open SSL Intermediate CA Certificate in your favorite text editor
  • Copy all the text
  • Open the SSL Certificate in the text editor, paste the copied text below the last line(Just after the —–END CERTIFICATE—–)
  • Configure your Node.js application with SSL Certificate and Private Key alone

Now, try starting your Node.js application, your SSL error would have been resolved.



Vijay

Under Construction! :D