Whitelisting Req/Conn Limiting
SupaIrish
nginx-forum at nginx.us
Fri May 30 23:18:08 UTC 2014
Hello!
I'm want to limit req/connections but have certain requests skip or
whitelisted from the throttling. I've found some prior threads that got me
this, which I think is working. Here's just the relevant config. Is this
the best/correct way to do this? And if so I don't really understand the
1 "" part of the map block. Can someone explain that? The map docs
(http://nginx.org/en/docs/http/ngx_http_map_module.html#map) aren't helping
me figure it out. Thanks!
http {
map $whitelist $limit {
default $binary_remote_addr;
1 "";
}
limit_conn_zone $limit zone=conn_limit_per_ip:10m;
limit_req_zone $limit zone=req_limit_per_ip:10m rate=5r/s;
server {
set $whitelist "";
if ( $hostname = some_url.com ) {
set $whitelist 1;
}
limit_conn conn_limit_per_ip 10;
limit_req zone=req_limit_per_ip burst=30 nodelay;
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250510,250510#msg-250510
More information about the nginx
mailing list