Re: Choose server by Host?

From: Chris Sarginson <chris#sargy.co.uk>
Date: Thu, 27 May 2010 11:09:40 +0100


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.

Chris

Jim Riggs wrote:
> I have a setup that looks something like this:
>
> frontend lb
> ...
> default_backend www
>
>
> backend www
> ...
> server web1
> server web2
> server web3
>
>
> 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?
>
> Thanks, all!
>
> - Jim
>
>
Received on 2010/05/27 12:09

This archive was generated by hypermail 2.2.0 : 2010/05/27 12:15 CEST