Welcome! Log In Create A New Profile

Advanced

Re: Exclude ip's from Nginx limit_req zone

Francis Daly
December 21, 2014 09:42AM
On Sat, Dec 20, 2014 at 06:18:03PM -0500, ASTRAPI wrote:

Hi there,

> limit_conn_zone $binary_remote_addr zone=alpha:8m;
> limit_req_zone $binary_remote_addr zone=delta:8m rate=40r/s;

> limit_conn alpha 5;
> limit_req zone=delta burst=80 nodelay;

> Now i want to exclude Cloudflare ip's from this connection limits.

Instead of using $binary_remote_addr, use a $new_variable which is empty
for Cloudflare IPs and equal to $binary_remote_addr for other IPs.

Ideally, something like

geo $new_variable {
default $binary_remote_addr;
# things that match cloudflare
10.0.0.0/8 "";
}

except that "geo" does not expand $variables.

So instead, use "geo" to set a flag, and then use "map" to set the value
you want:

geo $use_new_variable {
default 1;
# things that match cloudflare
10.0.0.0/8 0;
}

map $use_new_variable $new_variable {
default $binary_remote_addr;
0 "";
}

(Other possibilities exist.)

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Exclude ip's from Nginx limit_req zone

ASTRAPI December 20, 2014 06:18PM

Re: Exclude ip's from Nginx limit_req zone

mex December 21, 2014 05:25AM

Re: Exclude ip's from Nginx limit_req zone

Martin Frb December 21, 2014 05:52AM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 21, 2014 07:17AM

Re: Exclude ip's from Nginx limit_req zone

Francis Daly December 21, 2014 09:42AM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 21, 2014 10:11AM

Re: Exclude ip's from Nginx limit_req zone

B.R. December 21, 2014 11:26AM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 21, 2014 01:36PM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 24, 2014 09:01AM

Re: Exclude ip's from Nginx limit_req zone

Maxim Dounin December 24, 2014 09:34AM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 24, 2014 02:36PM

Re: Exclude ip's from Nginx limit_req zone

Maxim Dounin December 25, 2014 08:14AM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 25, 2014 01:32PM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI December 29, 2014 05:13PM

Re: Exclude ip's from Nginx limit_req zone

ASTRAPI January 03, 2015 07:35PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 94
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready