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.