how can i load balance my app (node.js).
At moment i have 2 versions of my application users will be routed depending on
what version they belong to. (Everything works good)
Now i want to load balance each version.
ex
I want "v1" to run under :3000 and 3001, 3002.
How can i do that without interfere with my current solution?
Current code.
map $cookie_version $mybackend {
default "127.0.0.1:3000";
"v1" "127.0.0.1:8080";
"v2" "127.0.0.1:3000";
}
...
location / {
proxy_pass http://$mybackend;
}
...
location ~ ^/(?<cver>v[12])/ {
...
add_header Set-Cookie "version=$cver;Domain=localhost;Path=/";
rewrite ^/v[12]/(.*)$ /$1 redirect;
}
Thanks.