Skip to content

Commit

Permalink
Add separate read/write rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Aug 10, 2021
1 parent 23c0830 commit c01e238
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions support/proxy/http.d/ratelimit.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
limit_req_zone $binary_remote_addr zone=ip:10m rate=5r/s;
limit_req zone=ip burst=50 delay=10;
limit_req_zone $binary_remote_addr zone=read_zone:10m rate=20r/s;
limit_req zone=read_zone burst=400 delay=40;

# Only limit writes
map $request_method $write_limit {
OPTIONS '';
HEAD '';
GET '';
default $binary_remote_addr;
}
limit_req_zone $write_limit zone=write_zone:10m rate=5r/s;
limit_req zone=write_zone burst=50 delay=10;

# Use 429 (Too Many Requests) for rate limit responses
limit_req_status 429;
Expand Down

0 comments on commit c01e238

Please sign in to comment.