I would like to redirect clients on a round robin basis with nginx if that's possible. However, most, if not all, of my research proxy the client rather than redirect.
I've seen this question and it's exactly what I'm trying to do, but round robin (or other strategies in the future e.g. least connections) instead of random.
Is there an elegant way to do it within nginx, or do I really have to resort to proxying to myself?
For reference, here is the implementation from the linked question:
upstream boxes {
server 127.0.0.1:46011;
server 127.0.0.1:46012;
}
server {
listen 46011;
return 302 http://box11.example.com$request_uri;
}
server {
listen 46012;
return 302 http://box12.example.com$request_uri;
}
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://boxes;
}
}