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