# Caddy

> Run FeatherPanel behind Caddy with automatic HTTPS. A minimal Caddyfile, what Caddy does by default and what to change for uploads.

Source: https://featherpanel.com/docs/panel/web-server/caddy/

The installer does not write a Caddy configuration and the repository has no Caddy template. Caddy still works well in
front of the panel because its `reverse_proxy` already does what the [nginx template](https://featherpanel.com/docs/panel/web-server/nginx) sets by
hand: it forwards `X-Forwarded-For`, `X-Forwarded-Proto` and `X-Forwarded-Host`, passes WebSocket upgrades, and has no
small header buffer to overflow.

## Caddyfile

```caddy
panel.example.com {
    reverse_proxy 127.0.0.1:4831
}
```

Caddy gets and renews a Let's Encrypt certificate for `panel.example.com` on its own. Ports 80 and 443 must be reachable
and the DNS record must point at the server. Do not run Certbot for the same domain.

Caddy sets no request body limit by default. To match the nginx template's 250 MB limit:

```caddy
panel.example.com {
    request_body {
        max_size 250MB
    }
    reverse_proxy 127.0.0.1:4831
}
```

## Install and reload

```bash
sudo apt install -y caddy
sudo nano /etc/caddy/Caddyfile
sudo systemctl reload caddy
```

> [!NOTE]
> The backend container runs FrankenPHP, which is built on Caddy. That Caddy is internal to the container and listens
> only inside the Compose network. It does not conflict with a Caddy on the host.
