negation in the map directive of nginx

libresco_27 nginx-forum at forum.nginx.org
Thu Sep 8 17:25:20 UTC 2022


Hi,

I'm working on rate limiting for specific group of client ids where if the
client id is equal to XYZ don't map it, thus, the zone doesn't get
incremented.

For ex - 
limit_req_zone $default_rate_client_id zone=globalClientRateLimit_zone:50k
rate=10r/m sync;
map $client_id $default_rate_client_id {
    "^(?!ZZZZZZ)$" "$1" 
} 

But this doesn't seem to work. Is this the correct way to negate a
particular string(ZZZZZ in this example)? Please let me know.

Thanks!

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,295157,295157#msg-295157



More information about the nginx mailing list