Hi,

To ensure a permanent IP we have a haproxy instance feeding AWS ELB to
a number of apache instances.

All of the vhosts are pinned to www.somedomain.com rather than
somedomain.com, though we have dns setup so that the endpoiont for
each domain and www.domain is the haproxy box.

What we need to do is redirect any traffic for somedomain.com to
www.somedomain.com.

I have tried a number of different ways with the haproxy frontend
config but cannot get it to work consistently (that would be my
failure not haproxys).

This is the nearest I have got:

frontend:
acl www_hdr hdr_beg(host) -i www.
reqirep ^Host:\ (.*)$ Host:\ www.\1 if !www_hdr
redirect prefix / code 301 if !www_hdr

If I then telnet to the haproxy I can see that the host line gets
rewritten correctly but I still get a 200 response not the expected
301.

Can anyone nudge me in the right direction please.

regards

Chris Allison

Reply via email to