{ acme_ca https://acme-v02.api.letsencrypt.org/directory # Bound the buffers: on 2026-09-30 caddy reached 5.9 GB anon-rss and the kernel # OOM-killed it three times, which took the whole site and API down with it. servers { trusted_proxies static 127.0.0.1/32 # TODO: your edge/CDN proxy CIDR trusted_proxies_strict timeouts { read_body 60s read_header 30s write 1h idle 5m } } } (api_common) { # There were NO access logs at all, so the 429 storm of 2026-10-03 could not be # attributed to a client until the relay log was grepped by hand. log { output file /var/log/caddy/access.log { roll_size 30MiB roll_keep 10 roll_keep_for 720h } format json } header { Strict-Transport-Security "max-age=15552000; includeSubDomains" X-Content-Type-Options "nosniff" Referrer-Policy "strict-origin-when-cross-origin" -Server } request_body { max_size 40MB } } api.your-domain.com { import api_common handle /v1/media/* { reverse_proxy 127.0.0.1:8000 { # media responses are large; stream instead of buffering whole bodies flush_interval -1 transport http { read_timeout 300s dial_timeout 10s } } } # [WEBAPP-WIRE 19.10] Mini App: /webapp -> 127.0.0.1:8850 handle /webapp { redir /webapp/ 301 } handle_path /webapp/* { reverse_proxy 127.0.0.1:8850 { header_up X-Real-IP {client_ip} flush_interval -1 transport http { read_timeout 60s dial_timeout 5s } } } handle { reverse_proxy 127.0.0.1:48001 { header_up X-Forwarded-For {client_ip} # generations and SSE streams outlive the defaults; "context canceled" / # "http2: stream closed" in the error log were proxies giving up early flush_interval -1 transport http { read_timeout 900s dial_timeout 10s keepalive 30s } } } } your-domain.com { import api_common reverse_proxy 127.0.0.1:48001 { header_up X-Forwarded-For {client_ip} flush_interval -1 transport http { read_timeout 900s dial_timeout 10s } } }