Well, it's not that it doesn't work but we have approximately 1200 domains
(that we actively develop on) and it doesn't seem very logical to hardcode
each domain in. I was wondering if there was a workaround for the lines
below so instead of using example.com:80 using a variable such as $HOST:80
(whichever host the end user is attempting to connect to).

backend production
       mode    http
       option  forwardfor
       balance source
       option  httpclose
       server  prod1 example.com:80 <http://example.com/>

On Fri, Dec 10, 2010 at 10:18 AM, Bryan Talbot <[email protected]>wrote:

> I do something similar using a config that is pretty much like what you've
> shown.  What doesn't work about the config you've shown?
>
> -Bryan
>
>
>
>
> On Fri, Dec 10, 2010 at 9:05 AM, Anthony Saenz <[email protected]
> > wrote:
>
>> Hi,
>>
>> Don't mean to bug but did anyone get a chance to possibly look at this and
>> provide some assistance or does anyone know of alternative means to get this
>> to work with cookie information?
>>
>> Thanks.
>>
>>
>> On 12/8/10 3:43 PM, Anthony Saenz wrote:
>>
>>> Hey,
>>>
>>> I was wondering if anyone could be of any assistance? I'm trying to use
>>> HAProxy to forward based on cookie and host. As it stands, I want HAProxy to
>>> see if a cookie is set and if it is, forward to a development server and if
>>> it isn't just push out to production. The main issue being, we have multiple
>>> production servers and a few thousand domains, so hard coding everything
>>> doesn't seem very efficient.
>>>
>>> Is there a way to have HAProxy forward the production request based on
>>> the host the person is attempting to initially connect to without it being
>>> static in the configuration file? Here's what I have so far...
>>>
>>> global
>>>    daemon
>>>
>>> defaults
>>>    mode http
>>>    timeout connect 10000 # default 10 second time out if a backend is not
>>> found
>>>    timeout client 300000
>>>    timeout server 300000
>>>    maxconn 60000
>>>    retries 3
>>>
>>> frontend read_cookies
>>>    bind    :80
>>>
>>>    acl is_servermagic hdr_reg(Cookie) dev_magic=.*
>>>
>>>    use_backend development if is_servermagic
>>>
>>>    default_backend production
>>>
>>> backend development
>>>        mode    http
>>>        option  forwardfor
>>>        balance source
>>>        option  httpclose
>>>        server  dev1 192.168.1.100:80
>>>
>>> backend production
>>>        mode    http
>>>        option  forwardfor
>>>        balance source
>>>        option  httpclose
>>>        server  prod1 example.com:80
>>>
>>>
>>
>

Reply via email to