if generic statement

Sean Allen sean at monkeysnatchbanana.com
Wed Apr 23 23:44:50 MSD 2008


On Apr 23, 2008, at 10:35 AM, Renaud Allard wrote:

> Hello,
>
> I would like to make some statements such as:
> if ($query_string ~ "someregex") {
> return 403;
> }
> To implement some mod_security like features for proxied web sites.
>
> But I see I can only use the "if" statement in the context of location
> or server. Is there a way to implement it as a generic rule for all
> virtual hosts without having to put includes in every server  
> declaration?
>
> Regards

what i do for these is:

put the rule in a file like checks.conf

then in each server or location

include the file.

actually it is a bit more complicated as multiple files get included in

SHARED.conf

which is then included. but you get the idea.
if you control all the virtual host conf files then that can work.






More information about the nginx mailing list