Add rate limits to the firewall UI#187
Conversation
The WAF zone API now carries a rate-limit set next to the rules. Add a Rate limits section to the manage page (key / rate-per-window / mode table with edit + delete), a /waf/limit add-edit page (bucket key builder with header/cookie names, rate + window presets, fixed/sliding algorithm, enforce/shadow mode, 429/503 rejection response, CIDR exclusions), and a Limits count column on the index. waf.set replaces the whole zone, so every call site now echoes both rules and limits — saving a rule no longer risks wiping limits and vice versa. Mock fixtures gain two seed limits for offline dev. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying deploys-app--console with
|
| Latest commit: |
917b502
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://58b4d69d.deploys-app--console.pages.dev |
| Branch Preview URL: | https://waf-ratelimit.deploys-app--console.pages.dev |
Exclude was dropped from the WAFLimit API. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Requests/Window row sized both controls to their content, so the row reflowed whenever the selected window label changed length. Give both fields fixed widths (w-40 / w-44). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New "Rate limit activity" section: a limited-share trend — one line per limit charting limited / (allowed + limited) percent per bucket from the new waf.limitMetrics RPC — plus a per-limit summary table (key, mode, allowed, limited, range share). Shadow limits render dashed with a "· shadow" legend suffix and their limited totals read "would be limited": this page is how a shadow limit gets sized before enforcing. Hidden when the zone has no limits; mock fixture generates drifting shares for the two seed limits so the chart renders offline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Added the rate-limit chart (design: limited-share trend): "Rate limit activity" on the metrics page charts |
|
Backend note: the chart calls |
Summary
The WAF zone API now carries a rate-limit set next to the rules (deploys-app/api#39). This adds the console UI:
/waf/limitpage (add/edit): bucket-key builder (IP / Host / Country / ASN / Header / Cookie rows with name inputs), rate + window presets (1s..1h, non-preset loaded windows preserved), fixed/sliding algorithm, enforce/shadow mode, rejection response (429/503 + message, hidden in shadow mode).waf.setreplaces the whole zone, so every call site (manage, rule edit, limit edit, create) now echoes bothrulesandlimits— saving a rule can't wipe limits and vice versa.bun lint+bun check: 0 errors. Verified visually againstbun dev:mock(manage, limit add/edit, index).🤖 Generated with Claude Code