How would I best filter traffic based on the request URI? What I'd like to do is limit access to the script some-script.php
when only a certain argument list is given. For instance, allow everyone to reach user_info
with associated user_id
value, but deny everyone access to action=admin_login
unless their IP address is on the LAN.
I know if
is evil and allow all
won't work as shown below but I can't seem to find what I'm wanting to do.
location ~* /live/some-script\.php {
// allow "?action=user_info&user_id=[0-9]{1,6}"
if ($request_uri ~* "action=bwg_frontend_data" ) {
allow all;
}
// deny everyone access to "?action=admin_login", but allow 192.168.100.0/24
if ($request_uri ~* "?action=admin_login.*")
{
allow from 192.168.100.0/24;
}
return 403;
}