With nginx how do I restrict to certain IP addresses based on regexp of $args
eg
for https://somewhere.invalid/login the URI location
location /login {
allow 1.2.3.4;
deny all;
}
makes sense
but how do I allow /login to all but restrict by IP where $args = "person=super"
eq https://somewhere.invalid/login?person=super
nginx does not allow "allow" statements in "if" blocks.
location /login {
allow all;
if ( $args ~ /person=super/ ) {
allow 1.2.3.4;
deny all;
}
}
Does it make any difference if the location block / is a proxy_pass ?