Developing HTTPS Services in Node with Self-Signed Certificates
mattcbaker.com
mattcbaker.com
Can all be bundled up in a single Docker container for super easy deployment. :)
Each engineer then has caddy running on his development machine with domains such as `server.username.example.com` and `web.username.example.com`.
The useful thing about this is that we're spread out remotely, but can at any point, while pairing or something like that, connect to the services running on each others machines. I've also grown used to simply using my own domain, rather than localhost, when developing, especially since it's served behind HTTPS.
$ caddy -host localhost "proxy / localhost:9000" "tls self_signed"
This will serve your Node application (assuming it's on port 9000) at https://localhost:2015/. And you can change the port from the default port with the -port flag.
One good reason is to mimic the production environment, as there are an increasing number of browser features that depend on HTTPS (HSTS, cookie secure flags, new html5 APIs like the location api, etc). Though when I do use https locally I also typically use an nginx reverse proxy.
So either I add an option to disable that (which I don't want to) or I simply reroute my traffic over a domain pointed at localhost I have a cert for.