> > Haproxy 1.5 and earlier cut the lines in words around spaces, so above your > expression does not work because it's split in two. Just remove the space > before "map" and it will do exactly what you need. Also I think it's better > to use a map than the plain header because this way you can ensure what the > exact list of accessible backends will be, and you can also get rid of some > matching details such as lower/upper case etc...
Thanks for the pointer. Removed the space, and it works. > > Do you think that use-server would simplify your configuration (eg: have > only one backend with thousands of servers, one per host) ? We could then > imagine something like this : > > frontend foo > use_backend bk_%[hdr(host),map(host_to_backend.map)] > > bk_host_xxx > server 1 ... > server 2 ... > > bk_virtual_hosted > use-server srv_%[hdr(host),map(host_to_server.map)] > server srv_1 ... > server srv_2 ... > > The idea would be to have a few backends for multi-server hosts, and a > single backend with all single-server hosts and as many servers. But maybe > this would make the config more complex in the end, I don't know. I think > the natural next step is the "usedst" server directive that people who want > to run proxies are requesting :-) I generate the configuration through a script, so I guess not much difference unless you think it is more optimal to run single-server backends by grouping them. On the other hand, it appears cumbersome when such host-servers start to scale-up and we have to move it from being a stag server to an actual backend for load-balancing. Not sure I understand the usedst directive. Dynamic lookup of server's target destination? :), Rajat