negation in the map directive of nginx

Francis Daly francis at
Sun Sep 11 22:56:14 UTC 2022

On Sun, Sep 11, 2022 at 11:22:39AM -0400, libresco_27 wrote:

Hi there,

> I tried the approach you suggested and it still doesn't seem to work. 
> This is what I am doing right now :-
> limit_req_zone $default_client_id zone=sample_zone:50k rate=3r/m sync;
> map $client_id $default_client_id {
>         ZZZZZ "";
>         $client_id $client_id;

Probably you want "default" there as the first word on the last line.

> When I try to hit the gateway with ZZZZ client_id, it still limits the
> requests according to 3rpm configuration. Am I doing this wrong?

The map has 5 Zs. Your example has 4 Zs.

But more interestingly: $client_id is not a standard nginx variable. How
is it being set; and what test are you running?

Presumably somewhere else in your config you have a "limit_req" directive,
so that you can see the delay between responses.


Francis Daly        francis at

More information about the nginx mailing list