Welcome! Log In Create A New Profile

Advanced

Whitelisting Req/Conn Limiting

May 30, 2014 07:18PM
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;
}
}
Subject Author Posted

Whitelisting Req/Conn Limiting

SupaIrish May 30, 2014 07:18PM

Re: Whitelisting Req/Conn Limiting

SupaIrish May 30, 2014 07:18PM

Re: Whitelisting Req/Conn Limiting

B.R. May 30, 2014 10:20PM

Re: Whitelisting Req/Conn Limiting

SupaIrish June 01, 2014 05:02AM

Re: Whitelisting Req/Conn Limiting

B.R. June 01, 2014 08:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready