Haproxy set variable value from map

I am trying to set a variable value from map contents, base on the path.

 http-request set-var(req.prefdomain) %[path,map_beg(/etc/haproxy/haproxy_path_domain.map)]

here is my map content

 /abc/def/v1        domain1
 /ijk/lmn/v2          domain2

My use case if the path (/abc/def/v1) is configured (in map) to be served on domain1 then i want to restrict the path on domain2. i was try to get the domain1 & domain2 in a custom variable. Using that variable to check the string match & handle routing or deny. Is there a way to get domain1 to prefdomain variable? if so can you suggest the fix for the above http-request line.