if ($remote_addr ~ and set $white_list for subnets?

classic Classic list List threaded Threaded
2 messages Options
xrd
Reply | Threaded
Open this post in threaded view
|

if ($remote_addr ~ and set $white_list for subnets?

xrd
Hi!
I want to mark same subnets to as $white_list. I currently use:

# urdas web
        location / {
        if ($remote_addr ~ "(10.10.1.128)|(10.20.1.53)|(10.30.14.56)") {
        set $white_list a712ba9579080e61cd89955a2cb837bf;
        }
        proxy_pass <a href="http://10.10.1.53:30081;">http://10.10.1.53:30081;
        proxy_set_header WhiteList $white_list;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        }

It work well. But works only by one IP address.  How to mark as subnets?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286617,286617#msg-286617

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
xrd
Reply | Threaded
Open this post in threaded view
|

Re: if ($remote_addr ~ and set $white_list for subnets?

xrd
I resoved it!

out of blocks I add:

geo $mark_nocapcha {
    default         0;
    10.10.1.0/24    1;
    10.20.1.0/24     1;
    10.30.33.0/24     1;
    10.30.14.0/24     1;
}


ANd add/substitute  in  server block
if ($remote_addr ~ "(10.10.1.128)|(10.20.1.53)|(10.30.14.56)") {
to
if ($mark_nocapcha) {

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286617,286618#msg-286618

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx