uechi.io/_posts/2020-02-07-secure-dev-server.md
Yasuaki Uechi d8cac182fc Update from Forestry.io
Yasuaki Uechi updated _posts/2020-02-07-secure-dev-server.md
2020-02-07 03:16:33 +00:00

749 B

title date
Securing Local Dev Server 2020-02-07 00:00:00 +0900

Sometimes you want to interact with a local webserver with https support because of some browser APIs that are only available in an https environment.

You can easily create a self-signed TLS cert for development purposes with mkcert.

brew install mkcert
mkcert -install # Install the local CA in the OS keychain

After installing mkcert and generating system-wide local CA cert, you can create a certificate for each project.

cd awesome-website
mkcert localhost # this will generate ./localhost.pem and ./localhost-key.pem
npm install -g serve
serve --ssl-cert ./localhost.pem --ssl-key ./localhost-key.pem