On Thu, May 27, 2010 at 06:16:42AM -0500, Jim Riggs wrote:
> On 27 May 2010, at 5:09, Chris Sarginson wrote:
> 
> >> Externally, users can only hit our sites at www.example.com or 
> >> someapp.example.com, but internally for testing, monitoring, and 
> >> configuration purposes, we want to be able to hit the backend servers 
> >> individually (i.e. web[1-3].www.example.com, 
> >> web[1-3].someapp.example.com).  I could make 3 separate backends to handle 
> >> each of these and use a use_backend acl to pick based on the Host header, 
> >> but that seems like overkill and would be the only purpose those backends 
> >> serve.  Is there a way to balance to a _specific_ server based on the Host 
> >> header (no cookies)?  I know you can use a balance hdr, but that is doing 
> >> a hash of the header to pick the server.  I need to explicitly configure 
> >> `Host: webX.___.example.com' to go to the backend server webX.  Is that 
> >> doable somehow, or do I have to go the separate backend route?
> > 
> > I find the easiest way to do this is to add an alias to each host like you 
> > mention, and then set up DNS records to point to that servers external IP 
> > address, bypassing haproxy.  This way if you do start experiencing any 
> > issues you aren't having to debug 2 layers to find the cause - it's either 
> > the host or the loadbalancer.
> 
> I had considered this, but there are two issues with it:  1) If we are 
> testing something, the stack now looks different (we are not going through 
> the load balancer), and 2) I don't want to set up SSL on the servers (it is 
> all handled by stunnel on the haproxy box).  So, I still want all of the 
> traffic to go through haproxy.
> 
> Based on the lack of other ideas, I guess I will have to go the 
> separate-backend-per-server route.  :-\

I have still not implemented the "use-server" directive which was supposed
to select a server in the group, analog to what we do with use_backend.

In the mean time, some people use another technique : you set up some
reqirep rules in the frontend to replace "Host: xxx" by "cookie: srv=xxx",
then you just have to enable cookie-based persistence and have the correct
cookies assigned to your servers.

As often, this is dirty but it works ;-)

Willy


Reply via email to