https://github.com/haproxy/haproxy/blob/3d95717b58be0902078e0693e383bc32ea3a715a/src/proxy.c#L714 seems like it's not possible, haproxy seems to be using `strcmp` without expanding what's inside %[]. I wonder if it would be useful to anyone beside me?
On Mon, Feb 18, 2019 at 5:25 PM Joe K <goodjoe2...@gmail.com> wrote: > Hello everyone! > > > I wonder if there is a way to use %[...] syntax in use-server directives. > > > backend be_template > server-template websrv 1-100 localhost:6666 check disabled > use-server > %[req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map,websrv0)] > if { req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map) > -m found } > > Right now, using the above makes haproxy fail at startup with the > following error: > > > haproxy_1 | [ALERT] 048/161559 (1) : config : backend 'be_template' : > unable to find server > '%[req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map,websrv0)]' > referenced in a 'use-server' rule. > haproxy_1 | [ALERT] 048/161559 (1) : Fatal errors found in configuration. > > > Just in case, I've also asked the same question on the forum: > https://discourse.haproxy.org/t/in-use-server/3529 >