I have an HAProxy config file that's being built programmatically and I'm getting an error like the following for every single backend that's defined:

[WARNING] 073/153725 (1663) : parsing [/etc/haproxy/haproxy.cfg:964] : 'use_backend' ignored because backend 'bk_10716' has no frontend capability.

My config file is fairly straightforward and a simplified version with just one backend seems to work, so I can't put my finger on what's wrong.

My config file consists of this:

    tune.ssl.default-dh-param 2048
    log local1 debug
    chroot  /var/lib/haproxy
    user    haproxy
    group   haproxy
    maxconn 4000

    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client 50000
    timeout server 50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

listen stats
    bind *:1234
    stats auth admin:bdi2016
    stats uri /
    stats realm Haproxy\ Statistics
    stats enable
    mode http

frontend http:
    bind *:80
    mode http
    option httpclose
    option forwardfor

followed by a great number of these:

use_backend bk_10011 if { hdr_end(host) -i somedomainname.com }
    backend bk_10011
        server server_10011 check

Am I just missing something obvious/stupid?


It was just a dumb mistake. I needed to specify all of my use_backend if statements within the frontend instead of above each individual backend. This is why it worked with only one backend, because regardless of indentation the first use_backend "belonged" to frontend http: and every subsequent backend appeared orphaned.

| improve this answer | |
  • Good find. We didn't see that part of your config, did we? – vigilem Mar 15 '16 at 14:55
  • I don't know how clear it was from my original post, so I guess not really. It basically is exactly what the top codebox contained followed by many entries identical to the second codebox, so in a way the data is there, but I guess I should have just clipped off the top few backends and left the structure intact. – David Perry Mar 15 '16 at 16:48

You need to assign an ID number to the frontend (for example, ID 1). Then you need to assign said ID to the backend configs to match.

So it would be like this on the frontend:

frontend http:
id 1
bind *:80
mode http
option httpclose
option forwardfor

and like this on the backend(s):

use_backend bk_10011 if { hdr_end(host) -i somedomainname.com }
backend bk_10011
    server server_10011 id 1 check

At least that's what worked for me.

| improve this answer | |
  • Gave this a shot, no dice. – David Perry Mar 14 '16 at 20:01
  • Did you reload first? – vigilem Mar 14 '16 at 20:02
  • Yeah, didn't do much. Interestingly, if I remove all but one of the backends it works just fine, only seems to occur when I have two or more of them... – David Perry Mar 14 '16 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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