I needed to IP block something in nginx and I ended up with duplicated proxy_forwardproxy_forward
code. How can I refactor and un-duplicate this?
server{
location /admin{
allow 123.90.250.0/24;
allow 123.66.148.0/24;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://foo;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://foo;
}
}