Welcome! Log In Create A New Profile

Advanced

split traffic

ender ulusoy
May 22, 2019 07:50AM
Hi all,

I want to split %10 of the traffic on nginx reverse proxy. I have a setup
that runs 2 versions of the website on same servers.

new.domain.com
domain.com

I want to route the traffic and redirect the %10 to new.domain.com on /
location.
Currently I only redirect internal requests to new.domain.com to test the
site. But now we want to test the new one with real visitors and want their
feedback. There's not so much example on the internet. So I've decided to
ask after several failed attempts.

How can I achive this, any ideas? Thank you.


here is the basic configuration

upstream servers {
server 100.50.10.1:80
server 100.50.10.2:80;
}

map $remote_addr $is_web_internal {

202.212.93.190 1;

default 0;

}

server {
server_name domain.com;

location / {


if ($is_web_internal) {

return 301 https://new.domain.com.tr$uri ;

}




proxy_set_header Host $host;


proxy_set_header Connection "";



add_header Strict-Transport-Security "max-age=31536000;
includeSubdomains; always";

add_header X-Frame-Options SAMEORIGIN;

add_header X-Content-Type-Options nosniff;

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

proxy_set_header Accept-Encoding "";

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


proxy_pass http://servers;


}
}


server {
server_name new.domain.com;

location / {




proxy_set_header Host $host;


proxy_set_header Connection "";



add_header Strict-Transport-Security "max-age=31536000;
includeSubdomains; always";

add_header X-Frame-Options SAMEORIGIN;

add_header X-Content-Type-Options nosniff;

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

proxy_set_header Accept-Encoding "";

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


proxy_pass http://servers;


}
}



--
um Gottes Willen!
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

split traffic

ender ulusoy May 22, 2019 07:50AM

RE: split traffic

Reinis Rozitis May 22, 2019 08:32AM

Re: split traffic

ender ulusoy May 22, 2019 08:48AM

RE: split traffic

Reinis Rozitis May 22, 2019 09:28AM

Re: split traffic

Francis Daly May 22, 2019 09:34AM

Re: split traffic

ender ulusoy May 22, 2019 09:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 208
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