Working Web skill
Design a web rate limit strategy
Design web rate limits from abuse threats, resource cost, user identity, endpoint semantics, fairness, client guidance, and degraded operation.
Limit the costly or harmful action at the layer that can identify it correctly.
When to use
- Use for authentication, search, messaging, uploads, purchases, APIs, scraping, or expensive computations.
- Do not rely on IP address alone where shared networks, proxies, or attackers make it unreliable.
Procedure
- Inventory endpoints, methods, mutations, costs, dependencies, identities, clients, geographies, and abuse cases.
- Choose keys from account, credential, device, tenant, resource, action, and trusted network context with privacy review.
- Set burst, sustained, concurrent, and cumulative limits from capacity tests and legitimate usage distributions.
- Separate anonymous, authenticated, privileged, automated, and recovery paths with nonbypassable global protection.
- Make mutation retries idempotent and return clear status, limit scope, safe retry timing, and support path.
- Coordinate edge, gateway, application, queue, and dependency controls without accidental multiplicative blocking.
- Define fail-open or fail-closed behavior per risk, plus emergency overrides with expiry and audit.
- Test shared networks, distributed attacks, credential rotation, clock boundaries, retries, high-value customers, accessibility tools, and dependency failure.
- Monitor denial accuracy, evasion, capacity, user harm, and override use without logging secrets.
--- name: design-a-web-rate-limit-strategy category: web description: Design web rate limits from abuse threats, resource cost, user identity, endpoint semantics, fairness, client guidance, and degraded operation. Use when protecting APIs or web actions without locking out legitimate users. --- # design-a-web-rate-limit-strategy Limit the costly or harmful action at the layer that can identify it correctly. ## When to use - Use for authentication, search, messaging, uploads, purchases, APIs, scraping, or expensive computations. - Do not rely on IP address alone where shared networks, proxies, or attackers make it unreliable. ## Procedure 1. Inventory endpoints, methods, mutations, costs, dependencies, identities, clients, geographies, and abuse cases. 2. Choose keys from account, credential, device, tenant, resource, action, and trusted network context with privacy review. 3. Set burst, sustained, concurrent, and cumulative limits from capacity tests and legitimate usage distributions. 4. Separate anonymous, authenticated, privileged, automated, and recovery paths with nonbypassable global protection. 5. Make mutation retries idempotent and return clear status, limit scope, safe retry timing, and support path. 6. Coordinate edge, gateway, application, queue, and dependency controls without accidental multiplicative blocking. 7. Define fail-open or fail-closed behavior per risk, plus emergency overrides with expiry and audit. 8. Test shared networks, distributed attacks, credential rotation, clock boundaries, retries, high-value customers, accessibility tools, and dependency failure. 9. Monitor denial accuracy, evasion, capacity, user harm, and override use without logging secrets. ## Done - A rate-limit control plan records threats, endpoints, keys, algorithms, thresholds, responses, failure modes, overrides, and owners - Load, burst, shared-network, distributed, idempotency, dependency, fairness, failover, and false-positive tests verify protection