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.