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 migrating some infrastructure from multiple servers hosting specific sites to a load-balancing architecture using HAProxy on OpenBSD 4.6 macppc. Naturally, I'm starting with configuring content switching for the current setup (specific sites on specific servers) and my /etc/haproxy/haproxy.cfg is as follows:

    log   local0
    log   local1 notice
    #log loghost    local0 info
    maxconn 1024
    chroot /var/haproxy
    uid 604
    gid 604
    pidfile /var/run/

    log     global
    mode    http
    option  httplog
    option  dontlognull
    option  redispatch
    retries 3
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000
    stats enable
    stats auth user:pass

frontend http_proxy *:80
    # check to see which domain the reguest is for
    acl host_tld.domain.sub1 hdr_end(host) sub1.domain.tld
    acl host_tld.domain.sub2 hdr_end(host) sub2.domain.tld
    # send to the correct server
    use_backend server2 if host_tld.domain.sub1 or host_tld.domain.sub2
    default_backend server1

backend server1
    server httpd_server1

backend server2
    server httpd_server2

The goal is for all domains to be served by server1 except for domains sub1.domain.tld & sub2.domain.tld which should be dished out by server2 instead. However, when I try to start HAProxy, I get the following errors:

parsing /etc/haproxy/haproxy.cfg : backend 'server2' has no dispatch address and is not in transparent or balance mode.
parsing /etc/haproxy/haproxy.cfg : backend 'server1' has no dispatch address and is not in transparent or balance mode.
Errors found in configuration file, aborting.
Error reading configuration file : /etc/haproxy/haproxy.cfg

I've looked at the examples listed in the HAProxy 1.3 documentation and, but don't see where I've gone wrong. None of the examples seem to require either option transparent nor a balance mode. Also, the documentation for the dispatch option is curiously omitted from the 1.3 documentation, but I doubt it would be helpful in my troubleshooting anyway.

Where have I gone wrong?

share|improve this question
up vote 2 down vote accepted

You forgot the line "balance roundrobin" (or equivalent) as you need to have a balancing algorithm in a backend. Also, you're doing content switching, so please add "option httpclose" in your frontend or defaults section, otherwise second requests of keep-alive connections will not be matched.

share|improve this answer
Thanks, I had just found out on the HAProxy mailing list that balance roundrobin wasn't a built-in default until version 1.3.16 (and I'm running and that definitely resolved the issue. Extra thanks for the reminder about option httpclose. – morgant Jan 20 '10 at 22:03
@Willy Tarreu - Is that advice still valid for 1.6? (ie. do we need to do httpclose when content switching?) – UpTheCreek Oct 22 '15 at 11:13
@UpTheCreek: no, you're right, we don't need this anymore in 1.5 nor 1.6. "balance roundrobin" is the default, and since http-keep-alive is supported it is the default as well. – Willy Tarreau Nov 20 '15 at 7:50

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.