Skip to main content

Rate Limiting

Learning Focus

By the end of this lesson you will know how to set up Cloudflare rate limiting rules.

What Rate Limiting Does​

Cloudflare rate limiting blocks or challenges clients that exceed a defined request threshold within a time window — before traffic reaches your server.

Setting Up Rate Limiting​

  1. In Cloudflare dashboard: Security → WAF → Rate Limiting Rules
  2. Create a rule:
    • Matching URL: e.g., /wp-login.php or /* for site-wide
    • Threshold: e.g., 50 requests per 10 seconds
    • Action: Block, Challenge, or JS Challenge
    • Duration: How long the block lasts (e.g., 60 seconds)

Common Rate Limiting Patterns​

TargetThresholdAction
Login page (/wp-login.php)10 req/minBlock for 1 hour
API endpoint (/api/)100 req/minChallenge
Site-wide1000 req/minJS Challenge

Cloudflare vs OLS Rate Limiting​

FeatureCloudflareOpenLiteSpeed
LocationEdgeOrigin
Attack traffic reaches serverNoYes
GranularityURL + IP + headersPer-IP connection/request
info

Edge rate limiting is more effective for DDoS protection because it blocks abusive traffic before it consumes your server's resources.

Key Takeaways​

  • Rate limiting at the edge protects your server from volume-based attacks.
  • Configure aggressive limits for login and sensitive pages.
  • Use in combination with OLS-level per-client throttling for defense in depth.

What's Next​