Skip to content

Rate limits

Count each client IP's matching requests over 60, 300 or 600 seconds, and block or log a client over the limit.

Updated View as Markdown

A rateLimit rule counts the requests that match its conditions, per client IP. A client over the limit is blocked (403) until its count in the window falls back under the limit. Requests under the limit carry on to the next rule.

{
  "name": "login",
  "action": "rateLimit",
  "mode": "block",
  "rateLimit": { "limit": 20, "windowSeconds": 300 },
  "conditions": [
    { "type": "equals", "negate": false, "target": "path", "value": "/login", "caseSensitive": false },
    { "type": "equals", "negate": false, "target": "method", "value": "POST", "caseSensitive": false }
  ]
}
Field
rateLimit.limit 1 to 100,000 requests
rateLimit.windowSeconds 60, 300 or 600
mode block (the default), or log to record clients over the limit without blocking them
  • To count every request, use a condition that always matches, such as path regex ^/.
  • Counting is per client IP. Clients behind one address, such as an office’s network, share a count.
  • A rate limit can’t have a body condition, or come after a rule that has one.

Set a new limit’s mode to log first, check in the logs which clients go over, then change it to block. See Rate limit a login page.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close