Skip to main content

Enable SSL on Localhost

Taken from Docusaurus CLI.

There are multiple ways to obtain a certificate. E.g. mkcert can be useful.

  1. Run mkcert localhost to generate localhost.pem + localhost-key.pem.

  2. Run mkcert -install to install the cert in your local trust store, and restart your browser.

  3. Start the app with Docusaurus HTTPS env variables:

    HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem yarn start
  4. Open https://localhost:3000