Welcome! Log In Create A New Profile

Advanced

Re: redirect to another domain based on IP address

ender ulusoy
May 06, 2019 09:20AM
@Patrick Thanks, here is the config I have (short version)



upstream aaa {

192.168.1.1:80;

192.168.1.2:80;

}


upstream stage {

192.168.1.3:80;

192.168.1.4:80;

}



server {

server_name www.aaa.com;


location / {

add_header X-Content-Type-Options nosniff;

add_header X-XSS-Protection "1; mode=block";

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-For $remote_addr;

proxy_pass http://aaa;

}

}




server {

server_name stage.aaa.com;


location / {

add_header X-Content-Type-Options nosniff;

add_header X-XSS-Protection "1; mode=block";

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-For $remote_addr;

proxy_pass http://stage;

}

}



I want if any connection request send to www.aaa.com/$request_uri from
office ip (200.100.50.1); then Nginx will redirect all requests to
stage.aaa.com/$request_uri


All other requests from the world will go www.aaa.com



On Mon, May 6, 2019, 1:23 PM Patrick <201904-nginx@jslf.app> wrote:

> On 2019-05-06 12:10, ender ulusoy wrote:
> > We have a website under heavily development. So we divide the site to
> > 3 branches stage, demo and main. What our developers want from me is :
> > "every request from office ip address to main domain must redirect to
> > stage."
>
> We need more information about your architecture to be able to show you
> ways to do this.
>
> It might be more cost-effective to just chat with an engineer for hire.
>
>
> Patrick
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

redirect to another domain based on IP address

ender ulusoy May 06, 2019 05:12AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 06:24AM

Re: redirect to another domain based on IP address

ender ulusoy May 06, 2019 09:20AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 09:46AM

Re: redirect to another domain based on IP address

ender ulusoy May 06, 2019 09:48AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 10:10AM

Re: redirect to another domain based on IP address

ender ulusoy May 07, 2019 03:46AM

RE: redirect to another domain based on IP address

Reinis Rozitis May 06, 2019 07:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready