Is this possible / correct to configure multiple frontends that binds to the same port on HAProxy?

frontend A
    bind :80
    bind :2000-5000
    acl rule_about_A
    use_backend server_A if rule_about_A

frontend B
    bind :80
    acl rule_about_B
    use_backend server_B if rule_about_B

In this use case, the frontend A needs to bind to 80 and to the range 2000-5000. For the frontend B, I don't want to bind it to all of those ports, only to 80.

I thought it would looks clean if I configure it in that way, instead use a single frontend and play with the ACLs, but it seems like that configuration is making HAProxy works wrong - sometimes applies the correct rule and sometimes, not.

Before to join those frontends as a single one, is it possible to use multiple frontends that bind to same ports?

EDIT: BTW, I'm using HAProxy 1.5

1 Answer 1


No, you can't do this and expect sensible behavior.

The requests for port 80 will arrive seemingly randomly at one front end or the other. The result of such a configuration is undefined, and though not technically i valid, it is for all practical purposes a nonsensical configuration.

All of the rules applying on port 80 (or any port) need to be specified on a single frontend (or a single listen) that is bound to port 80.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .