feat: add rate limit allow list

This commit is contained in:
Rainer Killinger
2022-03-03 12:06:51 +01:00
parent c03b5d3faa
commit f10cd6c431
6 changed files with 413 additions and 356 deletions

View File

@@ -3,7 +3,18 @@
# create a custom request limit zone which can handle 160,000 IP-Addresses at the same time
# routes using this limit zone will limit each client to not send more than one request in 50ms
# be sure to use burst handling when needed, because most clients will fire some requests in parallel
limit_req_zone $binary_remote_addr zone=customstappslimit:10m rate=20r/s;
geo $isRateLimited {
default 1;
{{{ rateLimitAllowList }}}
}
map $isRateLimited $rateLimit {
0 "";
1 $binary_remote_addr;
}
limit_req_zone $rateLimit zone=customstappslimit:10m rate=20r/s;
server {
{{{ listener }}}