local-ssl-proxy and mkcert

Ocassionally, it’s helpful to run a local service with SSL. My particular scenario has an application that insists on redirecting everything to https even when running in development mode.

Start with by installing local-ssl-proxy:

1
npm install -g local-ssl-proxy

run it like so:

1
local-ssl-proxy --source 9001 --target 9000

if you want to avoid unsightly untrusted certificate errors install mkcert:

1
2
3
brew install mkcert
mkcert -install
mkcert mydomainname.com

Assuming that mydomainname.com resolves to your localhost (via /etc/hosts trickery for example) you can now do

1
local-ssl-proxy --key mydomainname-key.pem --cert mydomainname.pem --source 443 --target 3000

and access https://mydomainname.com with no certificate errors.

comments powered by Disqus