Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

split traffic based on uri

$
0
0
Hello,

Working on a new version of a web app, I need to redirect some uri to the new version (including /) while keeping not reworked pages on the old version. Old and new versions are hosted on differents servers.

Currently my solution is half-working because pages (php rendered) are correctly loaded from old or new versions, but all the statics assets (img, css, js) are loaded from old version. I guess this is because of the last location block :

location ~* /uri_v2/ {
try_files $uri $uri/ @v2;
access_log off;
}

location = / {
try_files $uri $uri/ @v2;
access_log off;
}

location / {
try_files $uri $uri/ @v1;
access_log off;
}

location @v1 {
proxy_pass http://v1.webapp.com;
proxy_set_header Host webapp.com;
add_header X-version v1;
add_header X-node $hostname;
}

location @v2 {
proxy_pass http://v2.webapp.com;
proxy_set_header Host webapp.com;
add_header X-version v2;
add_header X-node $hostname;
}

I can't find any logical solution to make this works. How can I tell nginx to load page's related content from the same backend that served the page ?

Thank you.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>