NodeJs: UNABLE_TO_VERIFY_LEAF_SIGNATURE

Posted on: 2021-01-03
Categories: Node

If you are able to access you website in the browser but are unable to query it fron NodeJs, there might be a issue with the certificates you installed on your website.

When I was trying to access my express application via http using axios, I got the error : UNABLE_TO_VERIFY_LEAF_SIGNATURE / unable to verify the first certificate. If you google that error most answers tell you to install the certificate locally or even disable the security in you application, which is less than ideal.

For me the issue was just that the main certificate was installed correctly on my website (via HA Proxy) (that's why I could access it without issue from a browser), but I forgot to also install the intermediate SSL certificate that DNSimple generated and somehow nodejs required it to work.

So my answer would be: make sure you included the intermediate SSL certificate when you configured your Reverse Proxy. You can check here how I did it with HA Proxy and DNSimple.