Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer

i would get a new external ip for the server that is supposed to host the images and bind the links to images within http://img.yourdomain.com/ so I won't complicate the existent architecture. Otherwise, I see they have KTCPVS: http://kb.linuxvirtualserver.org/wiki/KTCPVS_HTTP which is supposed to support url pattern routing.

share|improve this answer
    
Given a new subdomain for an image server, best practice is to use a whole new domain, as Yahoo does with yimg.com. This avoids cookies from being sent to/from the new website. –  Alister Bulman Nov 20 '10 at 9:20

What are you trying to gain by doing this? Nginx is very good at serving static media already, and very good at caching said media. Making it proxy connections (through the original web servers) to a static content server just seems redundant (the bad kind) and adding network overhead, since the traffic will have to comeback through the nginx server to be delivered.

Since the traffic is coming through the LVS box(en) anyway, why not have it direct traffic to the image server directly, referenced by a different domain name as the above posters have said.

If you really don't want the extra domain reference (you should consider it, it speeds up your site from the user end), have LVS send traffic for /images directly to the image server, it's capable of layer7 routing.

Bottom line is if you're trying to take load off the web servers, you should actually remove the load from the web servers. Proxying might save you disk space on those machines, but not much else since they still have to handle the requests AND pass the traffic.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.