HTTP limit req directives
limit_req_zone directive
http only; defines a named rate state zone. sync is commercial. Empty keys are excluded. The optional sync flag is commercial-only; variable rate is documented for commercial 1.31.3 and is not part of local OSS 1.26.3 syntax.
Formal Syntax & Structure
nginx syntaxnginx
limit_req_zone key zone=name:size rate=rate [sync];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | expression | Identify the rate bucket; an empty evaluated key is excluded. Use a trustworthy identity. |
| zone | zone=name:size | Name and allocate shared state across local workers. |
| rate | rate=number r/s or r/m (no space) | Set sustained request processing rate; use a fixed rate for the OSS baseline. |
| sync | literal sync (commercial only) | Optional cross-instance state synchronization; requires supported commercial deployment. |
Working Example
Example Snippetnginx
limit_req_zone $binary_remote_addr zone=search_rate:1m rate=2r/s;