Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.