Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to redirect requests to my load balancer by domain name with acl and hdr_dom, to a separate backend. The redirection works ok with the first request - 'GET /' (the destination server is a WordPress site) but when the client asks for the assets ('GET /blablabla/style.css' for example) the haproxy doesn't redirect it to the right backend anymore, but to the default one, with .

In the haproxy log I can see the correct host that the request is for (the one that I defined in hdr_dom) but it's like that since the GET request itself is relative (I mean not containing the domain but only from the /blablabla and forth), haproxy doesn't recognize it with the hdr_dom. I'm just guessing here.. Please help...

share|improve this question

I have a configuration similar to this one and it works

use_backend webcams if { hdr(host) -i webcams.XX.YY webcams.YY.ZZ }
use_backend spain   if { hdr_dom(host) -i }
default_backend DEFAULT

Note that this config parses the "Host" header in two different ways: exact host name and domain only, always ignring the case.

Idea: are you parsing the correct part of the header? Only the domain, for example, instead of the whole hostname, or there is a case mismatch...

share|improve this answer
thanks for you answer, I've found out what was the problem, posted here as an answer. :P – SecondThought Nov 19 '12 at 10:49
up vote 0 down vote accepted

Sorry guys, my bad.

I found these in the haproxy cfg:

acl url_wordpress path_beg -i /wp-content

http-request deny if url_wordpress


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.