

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: DoS
incomplete
2: Rate Limiting
incomplete
3: Protecting Auth from Abuse
incomplete
4: Throttling Requests
incomplete
5: Queuing Work
incomplete
6: Resource Limits
incomplete
7: Timeouts
incomplete
8: Usage Quotas
incomplete
9: DDoS
incomplete
10: Mitigating DDoS
incomplete
11: Bot Detection
incomplete
12: CAPTCHA
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Rate limiting sets a maximum number of requests within a time window. For example, you might allow each customer to generate five reports per minute.
Once the limit is hit, reject new requests with 429 Too Many Requests and a Retry-After header. If you've ever used an AI provider, you've probably seen these... a lot.
Failing intentionally with an error message is much better than letting the server actually run out of resources and crash.
Rate limits are applied based on who is making the request:
Rate limiting is most effective at the CDN, load balancer, or in middleware that runs before your expensive application logic. The earlier you block abuse, the less it costs you.
The public product API is cheap to call repeatedly and useful to scrapers.
Add an endpoint-specific rate limit to /api/products.
With Bearly Secure still running, run and submit the CLI tests from the project root.