frontend frontend_main
...
use_backend %[req.hdr(host),lower,map(/usr/local/etc/haproxy/subdomains.map,backend_default)]
he content of /usr/local/etc/haproxy/subdomains.map would look like this:
#domainname backendname
one.example.com backend_one
two.example.com backend_two
...
etc.domain1.com backend_etc