OWASP's bot management cheat sheet calls rate limiting the foundational control and insists it be keyed on more than IP address: per session, per account, per card, and per token, because residential proxy networks make a single IP a weak unit of identity. That single fact explains most of what follows about rate limiting: what it can do, what it costs to run, and where it stops working.
Step one: set up the measurement first
The number, threshold, or window in this section is the part to keep. The algorithm matters more than the number. OWASP recommends token bucket or sliding window counters and warns against fixed windows, which let an attacker fire a full allowance at the end of one window and another at the start of the next.
Login and checkout need different thresholds because the legitimate shapes differ. A shopper may retry a payment a few times; nobody legitimately tries forty passwords, which is why OWASP pairs a per-username bucket with a per-IP bucket on login endpoints and requires both to pass. That is also the point where support tickets and chargebacks start, not where they end.
Step two: place the control where it bites
Nobody learns this from a quiet week; it shows up under load. A waiting room and a rate limit answer different questions. The limit says how much of one thing one actor may do; the waiting room says how many actors the origin can hold at once, in first in, first out order, with a cookie carrying each visitor's place.
Cloudflare's waiting room refreshes the queue page every 20 seconds, so a rate limit set tighter than that in front of a queue will punish exactly the visitors the queue is trying to keep informed. Budget for it as an operating cost, not as a surprise.
Two companion pieces on this site go deeper on the adjacent problems: credential stuffing controls covers the control order, and how scalper bots work covers the detection side. Read them alongside this one if rate limiting is only one layer of the problem you are looking at.
Step three: tune against real traffic
The distinction in this section decides real cases. Login and checkout need different thresholds because the legitimate shapes differ. A shopper may retry a payment a few times; nobody legitimately tries forty passwords, which is why OWASP pairs a per-username bucket with a per-IP bucket on login endpoints and requires both to pass.
Rate limits fail quietly against distributed attacks. Spread across thousands of residential addresses, each source stays under the threshold while the aggregate does the damage, which is why OWASP layers limits under behavioral and business-layer signals. It is a small detail that decides a disproportionate share of cases.
Step four: wire the response
Treat this as a working rule, then test it against your own logs. Cloudflare's waiting room refreshes the queue page every 20 seconds, so a rate limit set tighter than that in front of a queue will punish exactly the visitors the queue is trying to keep informed.
On the specific question this post answers, rate limiting: a step-by-step that follows how practitioners actually do it, the detail that decides it is easy to skim past. OWASP's bot management cheat sheet calls rate limiting the foundational control and insists it be keyed on more than IP address: per session, per account, per card, and per token, because residential proxy networks make a single IP a weak unit of identity. Anyone selling certainty past this point is selling past the evidence.
The step most teams skip
The honest version of the claim is the conditional one. Rate limits fail quietly against distributed attacks. Spread across thousands of residential addresses, each source stays under the threshold while the aggregate does the damage, which is why OWASP layers limits under behavioral and business-layer signals.
The algorithm matters more than the number. OWASP recommends token bucket or sliding window counters and warns against fixed windows, which let an attacker fire a full allowance at the end of one window and another at the start of the next. That is the difference between a control that holds on the day it matters and one that only looks right in a dashboard.
Read the fine print first, because the conditions are the content. A rate limit counts requests, not intent. It cannot tell a flash crowd of real buyers from a botnet that has learned to stay one request under the line.
Frequently asked questions
Does rate limiting work on its own?
No. A rate limit counts requests, not intent. It cannot tell a flash crowd of real buyers from a botnet that has learned to stay one request under the line. It belongs in a layered stack where other controls cover the gaps it leaves.
What is the first thing to check before relying on rate limiting?
Whether your own logs can prove it is working. Login and checkout need different thresholds because the legitimate shapes differ. A shopper may retry a payment a few times; nobody legitimately tries forty passwords, which is why OWASP pairs a per-username bucket with a per-IP bucket on login endpoints and requires both to pass. Without that measurement habit, you are trusting a dashboard instead of evidence.
Where does rate limiting fail most often?
In the gap between the claim and the mechanism. Rate limits fail quietly against distributed attacks. Spread across thousands of residential addresses, each source stays under the threshold while the aggregate does the damage, which is why OWASP layers limits under behavioral and business-layer signals. Most failures trace back to expecting the control to judge intent when it can only observe behavior.
What should sit alongside rate limiting in a working stack?
Controls from a different layer. The algorithm matters more than the number. OWASP recommends token bucket or sliding window counters and warns against fixed windows, which let an attacker fire a full allowance at the end of one window and another at the start of the next. Pairing two controls that fail the same way is not layering, it is duplication.