Skip to content

Caddy

Is a Web server Software

Setup

  • Docker image
  • Caddyfile explanation
  • Fix UDP Buffer Size error for QUIC connections on the host
    • sysctl -w net.core.rmem_max=2500000
    • sysctl -w net.core.wmem_max=2500000

Usage

  • caddy reload to reload configuration
    • In /etc/caddy in the Docker image
    • Reload in place with Docker: docker exec caddy caddy reload -c /etc/caddy/Caddyfile
  • HTTP/2 and HTTP/3 messages can be skipped if they are about :80

Caddyfile

Overall structure

web.site.net {
    respond "Hello, world!"
}

Commands

  • Return a fixed value: respond "Hello, world!"
  • Do some reverse proxying: reverse_proxy hostname:8080
  • Use a custom certificate: tls cert.pem key.pem - source
  • Define a basic authentication: see documentation on basicauth
    • Hash password with caddy hash-password -p <password>
    • With Docker, see Docker
  • Define a path within a site: use handle and handle_path (remove the path) within a configuration