xin

Directive reference

limit_req

Applies a request-rate zone to a context.

Syntaxlimit_req zone=name [burst=number] [nodelay | delay=number];
Contextshttpserverlocation
Defaultnone

Behavior

The zone and key are declared with limit_req_zone at http scope. burst permits a bounded queue or spike.

Example

limit_req_zone $binary_remote_addr zone=per_ip:10m rate=10r/s;

server {
    location /api/ { limit_req zone=per_ip burst=20 nodelay; }
}

Related directives

limit_req_zone · limit_conn