proxy_next_upstream enhancement

STEVENARD Kevin Kevin.Stevenard at alcatel-lucent.com
Thu Oct 8 18:51:10 MSD 2009


Hi,

I am currently having this architecture:

Client on the internet --> Firewall --> Reverse Proxy (NginX 0.7.62) -->
Load Balancer --> Application Servers

So I use Nginx just as a reverse proxy, and also to handle the ssl job,
my actual problem is that Nginx only knows the load balancer (which is
used to split the load, detect dead server or undeployed apps, do sticky
session with cookie inserts) and my load balancer sometimes receive 503
errors from application servers (most of the time because they are
starting or shutting down) but my load balancer is not able to retry
when a 503 happens. That's why I use the "proxy_next_upstream" to retry
the same request on other upstream server.

The thing is that if I don't want to bypass my loadbalancer I must
declare multiple times my load balancer to force nginx to retry multiple
times and if I have chance the load balancer will try the query on
another server. Which is probably not the best.
I have seen that we can declare an upstream server as "backup" or "down"
so I have tried to define my loadbalancer as the default server and my
application servers as backups to only try directly on them when my load
balancer get a 503 (in this case I am sure to retry on every single
servers). But unfortunately we can't combine "proxy_next_upstream" with
"backup" upstream servers. Why isn't it possible? I have found into the
code where I can make it possible to retry on backups servers when my
active one get a 503. I have attached a patch, if somebody can tell me
if I am doing something wrong.

Best Regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ngx_http_upstream.c.patch
Type: application/octet-stream
Size: 2400 bytes
Desc: ngx_http_upstream.c.patch
URL: <http://nginx.org/pipermail/nginx/attachments/20091008/0ada7b76/attachment.obj>


More information about the nginx mailing list