Repository navigation
feat(deploy): make the web and admin static asset rate limits configurable - #10385
ashokram-si wants to merge 1 commit into
Conversation
…rable WEB_ASSET_RATE_LIMIT and ADMIN_ASSET_RATE_LIMIT set the per client IP requests per minute of the web and admin Caddy servers (default 300). Closes makeplane#10340 Refs makeplane#9977, makeplane#10341
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
The web and admin frontends' Caddy servers allow 300 static asset requests per client IP per minute, fixed in their Caddyfiles. A full page load can fetch several hundred files, and everyone behind one NAT shares the limit, so self hosted installs can hit HTTP 429 on normal page loads (#9977, #10341). As proposed in #10340, this makes the limit configurable and keeps 300 as the default:
apps/web/caddy/Caddyfileandapps/admin/caddy/Caddyfilereadevents {$WEB_ASSET_RATE_LIMIT:300}and{$ADMIN_ASSET_RATE_LIMIT:300}.deployments/cli/community/docker-compose.ymlpassesWEB_ASSET_RATE_LIMITandADMIN_ASSET_RATE_LIMITto thewebandadminservices (default 300), andvariables.envlists both with a short note on when to raise them.Nothing changes for an install that doesn't set them, and upgrades through
install.shpick up the new keys with their defaults. Swarm uses the same compose file. The AIO image serves the frontends through its own proxy Caddyfile, which has no such limit. The limit counts per container, so with more than one web replica each keeps its own count. Kubernetes installs (as in #10341) need the two variables in the Helm chart, which lives in its own repository; I can follow up there, and on the self hosting docs, if you'd like.#9978 raises the fixed number instead. The two fit together: this keeps the default the issue asks for and can carry whatever default you settle on, so whichever lands second only needs the default updated.
Type of Change
Test Scenarios
caddy-builderstage ofapps/web/Dockerfile.web(Caddy withcaddy-ratelimit) and rancaddy adapton both Caddyfiles: unset givesmax_events300,WEB_ASSET_RATE_LIMIT=1200/ADMIN_ASSET_RATE_LIMIT=1200give 1200, and a value that isn't a number stops Caddy at startup with "invalid max events integer", naming the line.docker compose --env-file variables.env configon the community compose file renders both variables as 300, and an exportedWEB_ASSET_RATE_LIMIT=900comes through as 900. An empty value inplane.envfalls back to 300 through${...:-300}.References
Closes #10340
Related #9977, #10341
Summary by CodeRabbit