← Back to TIL list

How to add self-signed certificates for local development

Most of the steps I had to take for my local setup are outlined in a dev.to article aptly named Using the magic of mkcert to enable valid https on local dev sites.

One thing that article does not mention is that you need to convince NodeJS that everything is fine with the local certificates and the local CA stuff. You need to add an export to your .zshrc/.bashrc or whatever else you use to set that stuff globally in your terminal: export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" Now, NodeJS will be happy, too. Don't forget to refresh your terminal session for the setting to take effect.

And with that, you can easily use fresh, locally sourced certificates for your development environments.