I’m trying to block certain IP ranges at my nginx server, but would like
to
offer the ability to bypass the block by completing a back-end CAPTCHA,
which would set a cookie.
Currently I set the block like so:
geo $remote_addr $blocked {
default 0;
include /etc/nginx/conf/nginx-blocked-ips.conf;
}
Since I can’t nest “if” statements and I can’t make a compound check
using
“&&” or “||” or something similar, how can I check both the blocked
variable
and look to see if a cookie is set?
If it is blocked by geo, and has no cookie_whatever, then $reallyblocked
is 1. If it has any value for cookie_whatever, or $blocked is not 1,
then $reallyblocked is 0.