Tips > Ops & Security

Use Caddy as a Reverse Proxy for Automatic SSL

Caddy provides automatic HTTPS via Let's Encrypt with zero certificate management.

Caddy provides automatic HTTPS via Let's Encrypt with zero certificate management. Compared to the Nginx + Certbot combination, Caddy eliminates cron-based renewal scripts, manual certificate paths, and SSL configuration boilerplate. Its entire reverse proxy config for n8n fits in three lines.

Real-world example: You expose n8n at n8n.example.com with automatic SSL, HTTP/2, and WebSocket support (required for the n8n editor).

n8n.example.com {
    reverse_proxy n8n:5678
}
```text
```yaml title="docker-compose.yml (adding Caddy)"
services:
  caddy:
    image: caddy:2-alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"  # HTTP/3

    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config
    depends_on:
      n8n:
        condition: service_healthy

  n8n:
    image: n8nio/n8n:1.94.1
    restart: unless-stopped
    # Remove the ports mapping -- Caddy handles external access

    # ports:

    #   - "5678:5678"

    environment:
      N8N_HOST: n8n.example.com
      N8N_PROTOCOL: https
      WEBHOOK_URL: https://n8n.example.com/

volumes:
  caddy_data:
  caddy_config:
```text
> **Tip: WebSocket Support**
>
> Caddy automatically proxies WebSocket connections. No additional `upgrade` or `connection` headers are needed, unlike Nginx where you must explicitly configure `proxy_set_header Upgrade` and `proxy_set_header Connection`.

Caddy will automatically obtain and renew a TLS certificate for `n8n.example.com`, redirect HTTP to HTTPS, and enable HTTP/2 -- all with the two-line Caddyfile above.

**Related:** [Set a Unique Encryption Key and Back It Up](../security-best-practices/01-set-a-unique-encryption-key-and-back-it-up.md) | [Configure Payload Size and Binary Data Mode for Large Files](../performance-and-large-files/01-configure-payload-size-and-binary-data-mode-for-large-files.md)

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

191 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book a 20-minute call