fix(cinny-nginx): give content-hashed app files their own rate budget
Lint / Shell (shellcheck) (pull_request) Successful in 15s
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Landing page is rendered (matrix (pull_request) Successful in 5s
Lint / Python (ruff) (pull_request) Successful in 6s
Lint / Python deps (pip-audit) (pull_request) Failing after 57s
Lint / Secret scan (gitleaks) (pull_request) Successful in 11s
Lint / Shell (shellcheck) (push) Successful in 11s
Lint / JS (eslint) (push) Successful in 9s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 8s
Lint / Python deps (pip-audit) (push) Failing after 51s
Lint / Secret scan (gitleaks) (push) Successful in 6s

A cold page load fires ~75 requests within a second and the service worker
precaches all ~126 build files at once (every deploy renames them), both
past chat_limit's burst of 60. The excess got 503 "limiting requests":
a fresh visit to /register/matrix.org rendered blank (4 chunks refused),
and precache installs could fail after deploys. Like decorations (matrix
#22), hashed js/css/fonts/images/wasm now use assets_limit (100 r/s,
burst 400); pages and the webhook keep chat_limit. The deploy validates
with nginx -t and restores the old config on failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
Lotus CI
2026-10-24 17:05:11 -04:00
co-authored by Claude Opus 5.5
parent 4bb2dd4449
commit ad7d735739
+14
View File
@@ -17,6 +17,14 @@ map $uri $lotus_shell_cache_control {
# decoration picker can fetch hundreds of thumbnails, which would otherwise use
# up chat_limit and 503 the app's own files.
limit_req_zone $binary_remote_addr zone=decorations_limit:10m rate=100r/s;
#
# [cinny #201 follow-up] Content-hashed app files (js/css/fonts/images/wasm)
# likewise: a cold page load fires ~75 requests within a second, and the
# service worker precaches all ~126 build files at once (every deploy renames
# them), both past chat_limit's burst of 60, so chunks 503ed and pages
# rendered blank / the precache install failed. Immutable files, cheap to
# serve; pages and the webhook keep chat_limit.
limit_req_zone $binary_remote_addr zone=assets_limit:10m rate=100r/s;
server {
listen 80;
@@ -85,6 +93,8 @@ server {
}
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
include snippets/cinny-security-headers-framed.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}
@@ -93,6 +103,8 @@ server {
# Cache content-addressed static assets aggressively
location ~* \.(?:js|css|woff2?|png|svg|ico|webp)$ {
include snippets/cinny-security-headers.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}
@@ -189,6 +201,8 @@ server {
}
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
include snippets/cinny-security-headers-call.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}