Hi Rickard
It is possible, but of course, if would be better to avoid such “hacky” requirements.
I don’t understand what you want to achieve.
Make sure you make a logical separation between servers (as in host running a webserver) and services (e.g. “mail.acme.org”, “www.acme.org”) in your mind, and have a clear understanding before planning on which services should be running on which servers.
From your description, it is not clear which service should run on which server.
Is it the same service running on all three servers?
You may want to use Named ACL’s to define services (as in HTTP “host” header) and backends that are running a service.
You can then combine the acl names to build your own custom complex “routing” rule.
I made the following demo config, just to illustrate what haproxy could do (not tested):
Keep in mind, Named ACL’s can also be used in backends.
However, it is always better use backends with multiple backend servers, and use check, backup and weight to determine which server will get the requests. Use cookie for session persistence if you need. This model is much more robust:
@Toni - this looks like an excellent idea, ACL’s I backend, never thought they would superceed the initial server list and their status, I will give it a test !