From 7fbb1febce3d6098c0e9fb72fba4f2119746c725 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 6 Jan 2019 18:07:49 -0500 Subject: [PATCH] Document NODE_EXTRA_CA_CERTS for Node.js Fixes #78 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5fb816d..09714c9 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,14 @@ On iOS, you can either use AirDrop, email the CA to yourself, or serve it from a For Android, you will have to install the CA and then enable user roots in the development build of your app. See [this StackOverflow answer](https://stackoverflow.com/a/22040887/749014). +### Using the root with Node.js + +Node does not use the system root store, so it won't accept mkcert certificates automatically. Instead, you will have to set the [`NODE_EXTRA_CA_CERTS`](https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file) environment variable. + +``` +export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" +``` + ### Changing the location of the CA files The CA certificate and its key are stored in an application data folder in the user home. You usually don't have to worry about it, as installation is automated, but the location is printed by `mkcert -CAROOT`.