Enable SSL on Localhost
Taken from Docusaurus CLI.
There are multiple ways to obtain a certificate. E.g. mkcert can be useful.
-
Run
mkcert localhost
to generatelocalhost.pem
+localhost-key.pem
. -
Run
mkcert -install
to install the cert in your local trust store, and restart your browser. -
Start the app with Docusaurus HTTPS
env
variables:HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem pnpm start