All tools / Docker Compose examples
Caddy reverse proxy with automatic HTTPS with Docker Compose
Caddy in front of your app, getting and renewing Let's Encrypt certificates automatically.
compose.yaml
services:
caddy:
image: caddy:2.10
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
configs:
- source: caddyfile
target: /etc/caddy/Caddyfile
volumes:
- caddy-data:/data
- caddy-config:/config
configs:
caddyfile:
content: |
app.example.com {
encode zstd gzip
reverse_proxy app:3000
}
volumes:
caddy-data:
caddy-config:
How to use it
Commands
docker compose up -d docker compose ps docker compose logs -f
- Point your domain's DNS at this server and open ports 80 and 443 before starting; Caddy gets the certificate on first start.
- Add your app as another service in the same file, named to match the upstream (app:3000).
Prefer Kubernetes? See the Caddy reverse proxy with automatic HTTPS Kubernetes version.