D
D
Drammm2017-01-02 17:18:30
Nginx
Drammm, 2017-01-02 17:18:30

Combining $whitelist $limit and $server_protocol in NGINX?

I am pathologically enraged by various bots that roam the site and do not bring money.
I try to fight them

geo $whitelist {
default 0;
64.68.80.0/21 1;
}
map $whitelist $limit {
0 $binary_remote_addr;
one "";
}
limit_req_zone $limit zone=vse:10m rate=15r/m;

How do I add $server_protocol HTTP/1.1 to this condition so that the condition looks like this?:
IP from $whitelist and HTTP/1.1 = no limit
IP NOT from $whitelist and HTTP/1.1 = limit #1
all others = limit #2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drammm, 2017-01-02
@Drammm

So far I have composed something like this, but I don’t understand how to set different limits

map "$whitelist:$server_protocol" $limit {
"0:HTTP/1.0" "$binary_remote_addr";
"1:HTTP/1.0" "";
"0:HTTP/2.0" "$binary_remote_addr-#2";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question