user177174
user177174

Reputation: 11

Exclude ip address from nginx limits

I would like to exclude 1 static ip address "217.55.190.187" from nginx limits I tried installing geo module but it didn't work

geo $limited_ip {
default      1;
217.55.190.187  0;
}

map $limited_ip $limited_ip_key {
    0 '';
    1 $binary_remote_addr;
}
        limit_req_zone  $binary_remote_addr  zone=wafd1:10m   rate=10r/s;
        limit_req   zone=wafd1 burst=40 nodelay;

        limit_conn_zone  $binary_remote_addr zone=wafd:10m;
        limit_conn   wafd 15;

and still got errors:

2013/12/30 20:48:37 [error] 12550#0: *4646 limiting requests, excess: 40.080 by zone"wafd1", client: 217.55.190.187, server: alwafd.

I think it can be done by if statement

Any ideas?

Upvotes: 1

Views: 2949

Answers (1)

Mikhail Zakharenko
Mikhail Zakharenko

Reputation: 11

you must use defined $limited_ip_key as key:

limit_req_zone  $limited_ip_key  zone=wafd1:10m   rate=10r/s;

Upvotes: 1

Related Questions