D
D
Drammm2016-12-25 13:16:57
Nginx
Drammm, 2016-12-25 13:16:57

Map question in Nginx?

All my users are on HTTP/2, a couple of percent of old devices are on HTTP/1.1 + bots on it.
And on HTTP/1.0 one guano climbs.
The idea to slow down all the wickedness that goes over HTTP/1.0, I try like this:
map $server_protocol $limit {
"HTTP/1.0" $binary_remote_addr;
default "";
}
limit_req_zone $limit zone=bot:10m rate=1r/m;
I add this to the server
limit_req zone=bot burst=2;
As a result, in the logs I see that different animals make more than 1 request per minute from one IP using the HTTP / 1.0 protocol.
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drammm, 2016-12-26
@Drammm

tried like this

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

and got myself a 503 error
in the logs from my ip first request
7*.1*2.7*.2** - - [25/Dec/2016:22:19:19 +0300] "GET / HTTP/1.1" 301
second
7 *.1*2.7*.2** - - [25/Dec/2016:22:19:19 +0300] "GET / HTTP/2.0"
503

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question