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 have found that a random domain has set its DNS records to point to my server's IP address, which is a HAProxy load balancer in front of 4 apache servers. How do I prevent HAProxy from accepting requests from this domain, and only allowing requests to the legitimate domain?


share|improve this question
Can you elaborate on that? which DNS records? are you wanting to make sure that your server only responds positively to HTTP GET requests for your domain name? – Matt Mar 5 '12 at 18:21
up vote 2 down vote accepted

In the frontend definition in your HAProxy config:

frontend bla bla bla
<other settings>

#all HTTP traffic must use the correct site name
acl host-mysite hdr(Host) -i
redirect location if !host-mysite

<more settings for frontend>

backend foo
<backend config>

You could also outright block it if you prefer by using:

#block if request isn't for mysite
acl host-mysite hdr(Host) -i
block if !host-mysite
share|improve this answer
Thanks, much appreciated – Tom Mar 5 '12 at 21:38

Filter on the value of the Host HTTP header, e.g. hdr(Host) -i myhost.example.tld.

share|improve this answer
In iptables, or the HAProxy config, or where? – Tom Mar 5 '12 at 19:00
In the HAProxy ACLs. – Ignacio Vazquez-Abrams Mar 5 '12 at 19:01
Thank you very much – Tom Mar 5 '12 at 21:38

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.