Does HAProxy support a domain name for mapping a backend for route-based routing.
It currently supports maps for vhost:
frontend xyz
<other_lines>
use_backend backend1 if { hdr(Host) -i myapp.domain1.com }
use_backend backend2 if { hdr(Host) -i myapp.domain2.com }
Can be rewritten using maps as:
frontend xyz
<other_lines>
use_backend %[req.hdr(host),lower,map_dom(/path/to/map,default)]
With map file contents like:
#domainname backendname
myapp.domain1.com backend1
myapp.domain2.com backend2
But if routing is based on paths, as shown in the example below:
frontend xyz
acl host_server_myapp hdr(host) -i myapp.domain.com
acl path_path1 path_beg /path1
acl path_path2 path_beg /path2
use_backend backend1 if host_server_myapp path_path1
use_backend backend2 if host_server_myapp path_path2
Is it possible to have a mapping for this utility? Using basehdr (host) instead can give the whole path, but it will not have the flexibility of domains, because base- string comparison. Is there any other way to convert this to haproxy cards.
source
share