All services / Security / Rate Limiting
🚦
Security

Rate Limiting

Cap abusive request rates on your most sensitive endpoints to stop brute-force and APIAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server. abuse before it reaches originoriginYour own web server or host where your website actually lives. Cloudflare sits in front of it..

What it is

Rate Limiting protects specific endpoints from abuse by capping how many requests a client can make in a time window. It's ideal for login pages, APIsAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server., and expensive operations β€” shutting down brute-force, credential stuffingcredential stuffingUsing stolen username/password lists to try to break into many accounts at once., and scraping without affecting normal users.

Why it helps the client

  • Stops brute-force logins and credential stuffing at the edge.
  • Shields expensive endpoints β€” search, checkout, APIs β€” from being hammered.
  • Protects origin capacity and databases from abusive spikes.
  • Granular matching by path, method, header, or IP, with your choice of action.

Why they'd want it

  • Prevent account takeover and API abuse cheaply and instantly.
  • Keep the origin healthy under attack or accidental traffic storms.
  • Define rules in the dashboard in under a minute β€” no code.

πŸ”¬ How it actually works

  • Rate Limiting rules live inside the WAFWAFWeb Application Firewall β€” inspects web requests and blocks malicious ones (like SQL injection and XSS) before they reach your site.. Each rule counts requests matching an expression over a time window, keyed by IPIP addressA numeric address that identifies a device or server on the Internet., header, cookie, JA3, or a custom characteristic, and applies an action when the threshold is crossed.
  • It runs distributed at the edgethe edgeβ€œThe edge” means Cloudflare's servers spread across the world, close to your users β€” as opposed to one central data center., counting close to users but aggregating to enforce a global limit β€” ideal for login brute-force, OTP/SMS abuse, APIAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server. quotas, and expensive endpoints like search or checkout.
  • Actions are block, managed challenge, or log, applied for a configurable mitigation timeout. Advanced Rate Limiting (Enterprise) adds counting by response fields and complex composite keys.
  • Because it's expression-based, you can scope a limit to exactly one endpoint and one client dimension without affecting the rest of the site.

πŸ“– Key terms on this page hover any underlined term anywhere on the site for its definition

origin
Your own web server or host where your website actually lives. Cloudflare sits in front of it.
API
Application Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server.
credential stuffing
Using stolen username/password lists to try to break into many accounts at once.
the edge
β€œThe edge” means Cloudflare's servers spread across the world, close to your users β€” as opposed to one central data center.
IP address
A numeric address that identifies a device or server on the Internet.
WAF
Web Application Firewall β€” inspects web requests and blocks malicious ones (like SQL injection and XSS) before they reach your site.
DDoS
Distributed Denial of Service β€” an attack that floods a site with junk traffic from many sources to knock it offline.
bot
Automated software making requests instead of a human. Some bots are good (search engines); many are malicious.

Live demo walkthrough

5 steps

Screens below are annotated recreations of the Cloudflare dashboard. The numbered orange pin marks exactly where to click.

1

Select the website

πŸ‘† Account Home β†’ example.com
πŸ”’dash.cloudflare.com
example.com β–Ύ
Test Account NickN

πŸ‘‰ Do this

Open the site with the endpoint you want to protect.

πŸ’¬ Say this

β€œLet's protect a high-value endpoint β€” the login page β€” from brute-force abuse.”

2

Open the Rate limiting rules tab

πŸ‘† Left nav β†’ Security β†’ WAF β†’ Rate limiting rules
πŸ”’dash.cloudflare.com/example.com/security/waf/rate-limiting-rules
example.com β–Ύ
Test Account NickN

Security

WAF

Managed rulesCustom rulesRate limiting rules2
Cloudflare Managed RulesetCore protection against the OWASP Top 10 and common exploits, curated by Cloudflare.
Deployed
Cloudflare OWASP Core RulesetParanoia-level scoring for anomaly-based detection.
Deployed
Cloudflare Exposed Credentials CheckDetects logins using known-leaked username/password pairs.
Available

πŸ‘‰ Do this

Go to Security β†’ WAF, then click the 'Rate limiting rules' tab.

πŸ’¬ Say this

β€œRate limiting lives inside the WAF. I'll open the Rate limiting rules tab β€” this is where we set thresholds per endpoint.”

3

Create a rule

πŸ‘† Rate limiting rules β†’ Create rule
πŸ”’dash.cloudflare.com/example.com/security/waf/rate-limiting-rules/new
example.com β–Ύ
Test Account NickN

Security

WAF › Rate limiting rules

New rate limiting rule
Field: URI Pathequals/login
10 requests per 1 minute from the same IP
Action: Block for 10 minutes

πŸ‘‰ Do this

Click 'Create rule' and match the endpoint (e.g. URI Path equals /login).

πŸ’¬ Say this

β€œWe create a rule that matches just the login endpoint. Everything else on the site is unaffected.”

4

Set the threshold and action

πŸ‘† New rule β†’ Rate & action
πŸ”’dash.cloudflare.com/example.com/security/waf/rate-limiting-rules/new
example.com β–Ύ
Test Account NickN

Security

WAF › Rate limiting rules

New rate limiting rule
Field: URI Pathequals/login
10 requests per 1 minute from the same IP
Action: Block for 10 minutes4

πŸ‘‰ Do this

Set 10 requests / minute per IP, action Block for 10 minutes.

πŸ’¬ Say this

β€œWe say: more than 10 requests to /login in a minute from the same IP, block that IP for ten minutes. Brute-force is dead on arrival, and legitimate users never notice.”

5

Watch it work in Events

πŸ‘† Left nav β†’ Security β†’ Events
πŸ”’dash.cloudflare.com/example.com/security/events
example.com β–Ύ
Test Account NickN

Security

Events

Add filter β–Ύ5
Sampled logs
ActionServiceHostSource IPRule
BlockWAFexample.com203.0.113.9SQLi – Managed
BlockRate limitingapi.example.com198.51.100.2Login throttle
Managed challengeBot Managementexample.com192.0.2.44Score < 30
BlockAPI Shieldapi.example.com203.0.113.5Schema violation
BlockWAFexample.com203.0.113.77XSS – Managed

πŸ‘‰ Do this

Open Events and filter to the rate-limiting action on /login.

πŸ’¬ Say this

β€œMinutes after going live, the throttle shows up in Events β€” login attempts from the same IP blocked, origin untouched. That log is exactly what a security team wants for their brute-force runbook.”

Questions clients ask

Tap a question to reveal the answer to say
How is this different from the WAF or DDoS protection?β€Ί
DDoSDDoSDistributed Denial of Service β€” an attack that floods a site with junk traffic from many sources to knock it offline. stops floods; the WAFWAFWeb Application Firewall β€” inspects web requests and blocks malicious ones (like SQL injection and XSS) before they reach your site. blocks malicious *content*. Rate limiting stops too many otherwise-valid requests β€” for example 10,000 login attempts from one client β€” which neither of the others is designed to target.
Won't it block a legitimately busy customer?β€Ί
You tune thresholds per endpoint, key by IPIP addressA numeric address that identifies a device or server on the Internet./user/token, can use managed challenge instead of an outright block, and log-first to calibrate. Limits target abusive rates, not normal usage.
Can we enforce per-API-key quotas?β€Ί
Yes β€” key the rule on an APIAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server. token header or cookie to enforce per-client quotas, and match specific methods and paths.
How granular can the match be?β€Ί
Down to method + path + header/cookie/IPIP addressA numeric address that identifies a device or server on the Internet./country/botbotAutomated software making requests instead of a human. Some bots are good (search engines); many are malicious.-score combinations, so you can protect just /login or just POST /apiAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server./otp and nothing else.
Which action should we use?β€Ί
Managed challenge for user-facing endpoints so real humans get through, block for pure APIAPIApplication Programming Interface β€” how software talks to other software, e.g. a mobile app calling a server. abuse β€” each for a duration you choose.