Kitloft

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.

Customize names, versions →

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

Prefer Kubernetes? See the Caddy reverse proxy with automatic HTTPS Kubernetes version.