Welcome! Log In Create A New Profile

Advanced

Re: deny by ip and redirect

October 17, 2010 11:28AM
On Sun, 17 Oct 2010 10:36:42 -0400, Ilan Berkner <iberkner@gmail.com> wrote:

[...]
> 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?

Use the nginx geo module http://wiki.nginx.org/HttpGeoModule to set up a boolean-style variable - say, $internal_ip. Then put something like this in the server block for your test site:

if ($internal_ip != 1) {
rewrite ^ http://your.public.site/ permanent;
}

helen
Subject Author Posted

deny by ip and redirect

iberkner October 17, 2010 10:40AM

Re: deny by ip and redirect

SanCao Jie October 17, 2010 11:28AM

Re: deny by ip and redirect

helen October 17, 2010 11:28AM

Re: deny by ip and redirect

iberkner October 17, 2010 12:04PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 12:18PM

Re: deny by ip and redirect

iberkner October 17, 2010 12:20PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 12:28PM

Re: deny by ip and redirect

iberkner October 17, 2010 12:32PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 12:36PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 12:48PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 01:44PM

Re: deny by ip and redirect

iberkner October 17, 2010 03:12PM

Re: deny by ip and redirect

Igor Sysoev October 17, 2010 03:44PM

Re: deny by ip and redirect

iberkner October 17, 2010 04:58PM

Re: deny by ip and redirect

iberkner October 18, 2010 12:02AM

Re: deny by ip and redirect

Igor Sysoev October 18, 2010 12:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready