Skip to content
Snippets Groups Projects
Verified Commit 22fad44a authored by psy's avatar psy
Browse files

add predefined ratelimits

parent 5b201a05
No related branches found
No related tags found
1 merge request!1WIP: add predefined ratelimits
......@@ -128,6 +128,20 @@ path :''
satisfy: 'all
```
**ratelimitconfig**
```
# add one of the follwing predefined ratelimits to your location or vhost
custom:
- limit_req zone=10rps burst=20 nodelay;
- limit_req zone=100rps burst=20 nodelay;
- limit_req zone=1000rps burst=20 nodelay;
# define custom http status code for limited requests (defaults to 503)
custom:
- limit_req_status 444;
```
**mapsconfig**:
See https://nginx.org/en/docs/http/ngx_http_map_module.html#map
......
geo $limit {
default 1;
10.0.0.0/8 0;
192.168.0.0/24 0;
}
map $limit $limit_key {
0 "";
1 $binary_remote_addr;
}
limit_req_zone $limit_key zone=10rps:10m rate=10r/s;
limit_req_zone $limit_key zone=100rps:10m rate=100r/s;
limit_req_zone $limit_key zone=1000rps:10m rate=1000r/s;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment