Nginx proxy pass redirect through load balancer

load balancinglvsnginxproxypassredirect

I have several backend webservers that are load-balanced using LVS. These machines have only internal non-routable IPs on them. The load-balancer is the only machine with an external IP. This setup works great. I would like to add another webserver for image serving, but it will not be part of the load-balanced pool. Is it possible to proxy pass from the load-balanced web servers to the image server and have the response redirected to the client?

Client–>external LB–>internal web server–>internal image server

I've gotten proxy pass working when I remove the LB from the equation, but no luck when trying to use it.

Best Answer

Instead of LVS you could try HAproxy. In http mode it recognizes headers like "Host" which handles domain name. This way you could proxy static files directly to "internal image server"

Another way is to request another external IP and run two copy of LVS with different config - one for dynamic, one for static files, which binds on different external IP.

Related Topic