I'm using haproxy to direct route for several applications running on a single server. For one of the domains in use there are several dozens of subdomains that should be directed to one of a few applications.
Currently, I list all of those subdomains in a separte line. My frontend configuration looks like this:
frontend http-in
bind *:80
acl alpha hdr(host) -i alpha.com
acl beta hdr(host) -i beta.com
acl gamma00 hdr(host) -i apple.gamma.com
acl gamma01 hdr(host) -i banana.gamma.com
acl gamma02 hdr(host) -i cherry.gamma.com
acl gamma03 hdr(host) -i durian.gamma.com
acl gamma04 hdr(host) -i elderberry.gamma.com
acl gamma05 hdr(host) -i fig.gamma.com
acl gamma06 hdr(host) -i grapefruit.gamma.com
acl gamma hdr(host) -i gamma.com
use_backend a if alpha
use_backend b if beta
use_backend sub1 if gamma00
use_backend sub1 if gamma01
use_backend sub1 if gamma02
use_backend sub2 if gamma03
use_backend sub2 if gamma04
use_backend sub2 if gamma05
use_backend sub2 if gamma06
use_backend g if gamma
default_backend default
Is there a way to achieve a similar result in more concise form? Is such listing effective, or would it be better to switch to a regex at some point?