Serving https for localhost

For certain time that you need to run your local development server in https (e.g. Oauth callback to local development server), you can run the server in SSL mode using mkcert

$ brew install mkcert
$ mkcert localhost 127.0.0.1 ::1
Created a new local CA 💥
Note: the local CA is not installed in the system trust store.
Note: the local CA is not installed in the Java trust store.
Run "mkcert -install" for certificates to be trusted automatically ⚠️
Created a new certificate valid for the following names 📜
 - "localhost"
 - "127.0.0.1"
 - "::1"
The certificate is at "./localhost+2.pem" and the key at "./localhost+2-key.pem" ✅
It will expire on 9 January 2025 🗓
$ mkcert -install

Now we have the pem files that we can use to run the server in TLS mode.

#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.