Having a TLS certificate is not a common requirement for local development. Moreover, many tools, like Angular or Parcel allow you to seamlessly generate certs with a runtime options. That said, sometimes you might need to serve HTTPS traffic to an application that doesn’t support TLS certificates auto-generation. In this cases, there is no elegant workaround, rather than actually generate the certificates manually. It can be done using tools, like openssl, and there is a number of great how-to articles on the topic, for example this one.
Caddy is a web server written in go that among other features automates TLS certificates generation. All you need for Caddy to proxy traffic to your app is one simple command:
# considering the app is running on port 3000 caddy reverse-proxy --to http://localhost:3000
For more complex usecases, Caddy also has a notion of
Caddyfile, which is the same as configuration file.
For the install process, refer to the Download section of the Caddy docs.
Depending on preferred method of your installation, you might need to make your system trust the TLS certificates Caddy generates.
# adds certs into the local trust store caddy trust
Up until Caddy’s recent release, there is a know issue affecting Google Chrome browsers (or other Chrome-based).
In case you see the warning from above, please check that you have the latest version of Caddy installed!