Upstream redirect instead proxy_pass

Hello,

I would like to use Nginx as Load Balancer (traffic). My config is:

upstream storages {
least_conn;
server str1 weight=1 max_fails=1 fail_timeout=10s;
server str2 weight=1 max_fails=1 fail_timeout=10s;
}

server {
listen 80;
server_name verteilen;
location / {
proxy_pass http://storages;
#return 302 $scheme://storages;
}
}

How can I redirect to the server of upstream? With proxy_pass does it
work
but I want to move the traffic to several servers.
I just need the “storages” variable.

Sven

Posted at Nginx Forum:

Hello!

On Sun, May 17, 2015 at 01:07:30PM -0400, EvilMoe wrote:

How can I redirect to the server of upstream? With proxy_pass does it work
but I want to move the traffic to several servers.
I just need the “storages” variable.

The “upstream” directives defines servers for proxy - and things
like “least_conn” balancer in your config are not at all possible
unless nginx proxies connections.

If you want nginx to return redirects, you can use other
mechanisms available, like split_clients:

http://nginx.org/en/docs/http/ngx_http_split_clients_module.html


Maxim D.
http://nginx.org/

But split_clients has no health check, right?
WOuld it be possible to check the servers too like with upstream?

Posted at Nginx Forum: