In Cloudflare, what does a rate limiting rule count, and what happens to a client that goes over its threshold?
answer
- one counter per characteristic value
- requests per period is the threshold
- the action lasts for a duration
- Block defaults to 429
- counted in each data center
basics
~20 sA Cloudflare rate limiting rule counts matching requests, one counter per value of its characteristics such as the client IP. Once a counter passes requests per period, the action, such as Block with status 429, applies for the configured duration.
solid answer
~50 sA rate limiting rule has an **expression** (which requests it watches, for example `http.request.uri.path eq "/api/login"`), **characteristics** (what each counter is keyed on: IP on every plan, more on higher plans), a threshold of **requests** per **period** in seconds, an **action** (Block, Managed Challenge, Non-Interactive Challenge, Interactive Challenge, or Log on Enterprise) and a **duration**, the mitigation timeout. When one counter goes over the threshold, that request and every later matching request with the same characteristic values get the action until the duration ends. Block returns `429` by default, or a custom 400 to 499 status and body. Counters live in each Cloudflare data center, so the limit is approximate rather than an exact global count. On current plans every rate limit is such a rule in the `http_ratelimit` phase; the older usage-billed Rate Limiting is gone.
go deeper
Name the five parts: expression, characteristics, requests per period, action and duration. Say that Block answers 429 by default and that the action lasts for the duration.
Explain that a counter exists per combination of characteristic values per data center, and why cf.colo.id is always one of them. Know how challenge actions throttle on non-Enterprise plans.
Show you know the limits of precision: per-data-center counters, a few seconds of counting delay, and fail-open under overload. Say what that means for thresholds on globally spread traffic.
Frame the rule as abuse control rather than a quota meter, and decide which limits belong at the edge and which belong in the application's own accounting.
## What a rate limiting rule does A **rate limiting rule** is a rule in Cloudflare's Ruleset Engine that lives in the `http_ratelimit` phase, which runs after WAF custom rules and before the WAF managed rulesets. An ordinary rule acts on every request it matches. A rate limiting rule instead keeps **counters** and acts only once a counter passes a threshold. Since the previous, usage-billed Rate Limiting product was retired, every zone-level rate limit is one of these rules, created under **Security rules** in the dashboard or through the Rulesets API. ## The parts of a rule | Dashboard name | API field | What it controls | |---|---|---| | When incoming requests match | `expression` | Which requests the rule watches and acts on | | With the same characteristics | `ratelimit.characteristics` | What each counter is keyed on, such as `ip.src` | | Requests and Period | `requests_per_period`, `period` | The threshold: how many matching requests in how many seconds | | Then take action | `action` | `block`, `managed_challenge`, `js_challenge`, `challenge` or `log` | | For duration | `mitigation_timeout` | How long the action keeps applying once the threshold is crossed | Two optional parameters refine this. **Increment counter when** (`counting_expression`) decides which requests add to the counter when that should differ from the matching expression. **Also apply rate limiting to cached assets** decides whether requests answered from cache count too; turning it off (the API's `requests_to_origin: true`) counts only requests that go to the origin. ## Walking one request through a rule 1. A request reaches a Cloudflare data center and is tested against the rule's expression. If it does not match, the rule ignores it. 2. Cloudflare builds the counter key from the request's values for each characteristic, for example its source IP, plus the data center ID `cf.colo.id`. Every rule carries `cf.colo.id`: the dashboard adds it silently, and an API request must list it. 3. The counter for that key goes up by one. 4. While the count stays within **Requests** for the **Period**, the request continues to later rules. 5. Once the count goes over, the action applies to that request and, by default, to every later matching request with the same characteristic values until the **duration** ends, whatever the rate during that time. Two clients with different values for any characteristic never share a counter. A rule keyed on IP and an `x-api-key` header keeps separate counts for the same key sent from two addresses. ## What the client sees - **Block** answers with `429 Too Many Requests` unless you set a custom response. The custom response takes a status code from 400 to 499, a content type (`application/json`, `text/html`, `text/xml` or `text/plain`) and a body of up to 30 KB, so an API can return JSON its clients parse. Without one, the visitor sees Cloudflare's error 1015 ("Rate limited") page. - **Managed Challenge** (the challenge Cloudflare recommends), **Non-Interactive Challenge** (`js_challenge`) and **Interactive Challenge** (`challenge`) answer with a challenge page instead of the content. - **Log**, on Enterprise plans only, records matches without acting, which is how a threshold is validated before it is enforced. On Free, Pro and Business plans a challenge action cannot have a duration. The rule **throttles** instead: a visitor who passes the challenge has their counter reset to zero and is challenged again only if they reach the threshold again. Enterprise customers can set a duration with any action, and can also throttle with Block, letting requests through whenever the rate drops back under the limit. ## Plan boundaries - **Free**: one rule, counted by IP only, a 10-second period and a 10-second duration, matching on the URI path and verified-bot status. - **Pro**: two rules, periods up to 1 minute and durations up to 1 hour. - **Business**: five rules, the **IP with NAT support** characteristic, a custom counting expression that can read the response code and headers, excluding cached assets, periods up to 10 minutes and durations up to 1 day. - **Enterprise**: up to 100 rules depending on the contract; **Advanced Rate Limiting** adds characteristics such as a header, cookie, query parameter, host, path, ASN or country, JA3 and JA4 fingerprints with Bot Management, body fields, and counting by a complexity score. ## How exact it is - Counters are kept **per data center**. Only data centers serving the same geographic location share them, and there is no network-wide counter. - Counter updates can lag a detected request by a few seconds, so some requests over the limit still reach the origin before the action starts. - Under infrastructure overload, rate limiting **fails open**: Cloudflare may skip counting and enforcement rather than block legitimate traffic, and nothing tells you it happened. So a rate limiting rule is a control against abuse and overload, not an exact meter. A quota a customer is billed by belongs in the application's own accounting.
- Why does a visitor who solves a Managed Challenge from a rate limiting rule on a Pro zone get challenged again later?On Free, Pro and Business plans a challenge action cannot carry a duration, so the rule throttles. Passing the challenge resets that visitor's counter to zero. When requests with the same characteristic values reach the threshold again, Cloudflare issues a new challenge. Enterprise zones can set a duration with a challenge action, and then the action holds for that whole period.
- Is a Cloudflare rate limiting rule's counter global across the network?No. Each data center keeps its own counters, shared only with data centers serving the same geographic location, which is why `cf.colo.id` is a mandatory characteristic: hidden in the dashboard, explicit in the API. A client whose traffic lands on many locations can exceed the nominal rate in aggregate, and counters update with a delay of a few seconds, so some extra requests reach the origin.
- Past the threshold the rule only ever rejects the one request that went over.
- Every visitor shares one counter unless the expression names an IP address.
- Cloudflare keeps one exact global count, so exactly the limit reaches the origin.
- A rate limiting rule's Block action returns 403 Forbidden by default.
- Rate limits are still configured in the old usage-billed Rate Limiting product.
Assumes Cloudflare as of 2026-10-10: the usage-billed legacy Rate Limiting is retired, all rate limits are rules in the http_ratelimit phase, and the plan limits quoted are the current ones.