Skip to content

Commit c01e238

Browse files
committed
Add separate read/write rate limits
1 parent 23c0830 commit c01e238

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

support/proxy/http.d/ratelimit.conf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
limit_req_zone $binary_remote_addr zone=ip:10m rate=5r/s;
2-
limit_req zone=ip burst=50 delay=10;
1+
limit_req_zone $binary_remote_addr zone=read_zone:10m rate=20r/s;
2+
limit_req zone=read_zone burst=400 delay=40;
3+
4+
# Only limit writes
5+
map $request_method $write_limit {
6+
OPTIONS '';
7+
HEAD '';
8+
GET '';
9+
default $binary_remote_addr;
10+
}
11+
limit_req_zone $write_limit zone=write_zone:10m rate=5r/s;
12+
limit_req zone=write_zone burst=50 delay=10;
313

414
# Use 429 (Too Many Requests) for rate limit responses
515
limit_req_status 429;

0 commit comments

Comments
 (0)