HTTPS on localhost with Caddy
Jun 24, 2022
How to run HTTPS on loclahost with Caddy v2 server.
This config file will create reverse proxy from
https://localhost:2000 to some service which runs on
Caddy v2 config file
localhost:2000 reverse_proxy 127.0.0.1:4000 tls internal
start server with config
caddy run -config Caddyfile
You can do it even without config file with these commands
run these commands
caddy trust caddy reverse-proxy --to 127.0.0.1:4000 --from localhost:2000
Both of these commands will add self-signed certificate to your truststore and you will have to confirm warning in your browser complaining about it.