Count the number of available servers in dynamic backend


Can you advise how to set the following ACL, especially nbsrv:

frontend webfarm

acl MAIN_not_enough_capacity nbsrv([%[req.hdr(host),lower,map(/etc/haproxy/,bk_default)]]) eq 0
http-request redirect code 301 location if MAIN_not_enough_capacity
use_backend %[req.hdr(host),lower,map(/etc/haproxy/,bk_default)]

use_backend is working perfectly,but I don’t know how to set the same expression for nbsrv:

This is the error which haproxy returns when I try to restart:
error detected while parsing ACL ‘MAIN_not_enough_capacity’ : missing comma after conv keyword ‘map’ in ACL expression ‘nbsrv([%[req.hdr(host),lower,map(/etc/haproxy/,bk_default)]])’.

//haproxy version is 1.6.11.