Skip to content

Commit e66a139

Browse files
committed
docs: define the nginx rate limit key per client
The limit_req_zone keyed on $pw_limit, but that variable was never defined, so its value was empty and every client shared a single rate limit bucket. A single busy client could then exhaust the shared budget and throttle everyone. Define $pw_limit from the client address so the limit applies per client, and document setting it empty to exempt trusted hosts. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent b940993 commit e66a139

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎docs/deployment/nginx.conf‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Rate limiting key: the client address. Set to an empty string to
2+
# exempt a client from limiting (for example a trusted internal host).
3+
# Without this the zone key would be empty and every client would share
4+
# a single bucket instead of being limited individually.
5+
map $binary_remote_addr $pw_limit {
6+
default $binary_remote_addr;
7+
}
8+
19
# Rate limiting zone: allow 20 requests/second per client.
210
limit_req_zone $pw_limit zone=pw:10m rate=20r/s;
311

0 commit comments

Comments
 (0)