D
D
Drammm2016-12-27 07:28:39
Nginx
Drammm, 2016-12-27 07:28:39

Limit_req_zone "for everyone else" in NGINX?

Gentlemen, help me understand how it is possible to prescribe Limit_req_zone so to speak for "for everyone else" who are not included in the described conditions?
Here is an example
in http

map $server_protocol $limit {
        "HTTP/1.0"     $binary_remote_addr;
        default    "";
     } 
  limit_req_zone $limit zone=bot:10m rate=1r/m;

to the server
limit_req zone=bot;and everything works
But it's worth adding one more limit to http below
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

+ to the server
limit_req zone=one burst=5 nodelay;
as they become master and limit_req_zone from other conditions cease to be fulfilled.
Question: - how to register a couple of limit_req_zone for the conditions I need, and then another limit_req_zone "for everyone else"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dubart, 2017-05-26
@dubart

nginx.org/ru/docs/http/ngx_http_limit_req_module.html

There can be several limit_req directives. For example, the following configuration limits the processing rate of requests coming from a single IP address, and at the same time limits the processing rate of requests to a single virtual server:
limit_req_zone $binary_remote_addr zone=perip:10m rate=1r/s;
limit_req_zone $server_name zone=perserver:10m rate=10r/s;
server {
...
limit_req zone=perip burst=5 nodelay;
limit_req zone=perserver burst=10;
}
Directives are inherited from the previous level, provided that this level does not have its own limit_req directives.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question