split traffic
ender ulusoy
enderulusoy at gmail.com
Wed May 22 11:48:38 UTC 2019
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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190522/fa357fc4/attachment.html>
More information about the nginx
mailing list