deny by ip and redirect

Ilan Berkner iberkner at gmail.com
Sun Oct 17 18:36:42 MSD 2010


hi all,

I'd like to only allow a certain set of ip addresses to access one of our
test sites, and redirect anyone with a different ip address to our primary
domain.

location / {
  allow 1.1.1.1;
  deny all;
}

The above code works as expected, but I would like to do something like
this:

location / {
  if not 1.1.1.1 or 1.1.1.2 or 1.1.1.3 do a 301 redirect to
www.domain.com(with request uri)
}

is this possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101017/ae32f986/attachment.html>


More information about the nginx mailing list