How can I use different limit_req for one location depending if a get-argument is present or not? In logic:

if($_GET['a']){
     applyLimitA();
}else{
     applyLimitB();
}

I have achieved this but only by applying a limit_req if not a get-argument is present. In this config the return 418 is limitless.

location ~ /limited/.+ {
    error_page 418 = @limited;
    if ($args !~* .*user=.* ){
        return 418;
    }
    try_files       $uri =404;
    include         fastcgi;
}
location @limited {
    limit_req       zone=limitedzone burst=4;
    try_files       $uri =404;
    include         fastcgi;
}

Please point out anything else you might notice from this config.

link|improve this question
You're a teapot? I'm not seeing where your config applies the second limit? – Shane Madden Jan 18 at 2:08
It does not. That's what I want help to fix. – Gustav Jan 18 at 13:51
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.