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

antikurjers nginx-forum at forum.nginx.org
Sat Dec 28 11:42:30 UTC 2019


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 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



More information about the nginx mailing list