Repository Public
1# Caddy 2 — reverse proxy in front of the Sheet web process.2# Example only: written from the application's requirements (docs/DEPLOYMENT.md §12), not taken from a running server.3#4# Replace sheet.example.org with the host of APP_URL (they must match exactly: WebAuthn compares the origin) and5# 127.0.0.1:8700 with the address of the web process.67sheet.example.org {8 # TLS: Caddy obtains and renews the certificate by itself (the DNS record must already point here).910 # The application does not compress (next.config.ts: compress: false).11 encode zstd gzip1213 # Uploads: UPLOAD_MAX_MB (default 20) plus multipart overhead. The application enforces its own cap while14 # reading the body; this limit must not be lower, and stops oversized requests earlier.15 request_body {16 max_size 25MB17 }1819 # /render/<token> exists for the worker's headless browser, which talks to the web process directly20 # (INTERNAL_URL). Nothing outside needs it.21 @render path /render /render/*22 respond @render 4042324 # Job progress: server-sent events that can stay open for up to 30 minutes. Flush every write, never buffer.25 @events path_regexp ^/api/admin/generations/[^/]+/events$26 reverse_proxy @events 127.0.0.1:8700 {27 flush_interval -128 transport http {29 read_timeout 35m30 }31 }3233 reverse_proxy 127.0.0.1:8700 {34 # Client address: the application uses the LAST value of X-Forwarded-For (the one this proxy writes) for35 # rate limits, lock-out and the audit trail. Caddy sets the header to the address it saw and ignores a36 # value sent by the client unless the client is listed in `trusted_proxies` (global option); with a37 # trusted proxy in front, it appends, and the last value is then that proxy's address.3839 transport http {40 # The web server allows 5 minutes per request.41 read_timeout 5m42 response_header_timeout 5m43 }4445 # Used by Caddy to stop sending traffic to a dead upstream.46 health_uri /api/health47 health_interval 15s48 }4950 # Security headers (CSP, HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy, nosniff) are set by the51 # application for every path. Do not override them here.5253 log {54 output file /var/log/caddy/sheet.access.log55 }56}5758# Optional: send the bare "www" host to the canonical one.59# www.sheet.example.org {60# redir https://sheet.example.org{uri} permanent61# }62