v-dev-app01:/root# ping www.zjdev.com PING www.zjdev.com (192.168.32.16) 56(84) bytes of data. 64 bytes from 192.168.32.16: icmp_seq=1 ttl=64 time=0.238 ms acl zjdev_6_req hdr_beg(host) -i www.zjdev.com acl url_static_zjdev path_end .html .gif .png .jpg .css .js use_backend appserver_8001 if zjdev_6_req url_static_zjdev 匹配域名www.zjdev.com 且匹配.html .gif .png .jpg .css .js结尾 acl zjtest8_req hdr_beg(host) -i www.zjtest8.com use_backend zjtest8_8001 if zjtest8_req v-dev-app01:/root# curl http://www.zjdev.com/ test page from scan! v-dev-app01:/root# ping www.zjtest8.com PING www.zjtest8.com (192.168.32.16) 56(84) bytes of data. 64 bytes from 192.168.32.16: icmp_seq=1 ttl=64 time=0.175 ms 64 bytes from 192.168.32.16: icmp_seq=2 ttl=64 time=0.216 ms v-dev-app01:/root# curl http://www.zjtest8.com test jj 20160823 v-dev-app01:/root# curl http://www.zjdev.com/ test page from scan! v-dev-app01:/root# hdr_beg([<name>[,<occ>]]) : prefix match 前缀匹配: acl host_www hdr_beg(host) -i www acl host_static hdr_beg(host) -i img. video. download. ftp. 5.1.7 hdr_beg <string> 用于测试请求报文的指定首部的开头部分是否符合<string>指定的模式。例如,下面的例子用记测试请求是否为提供静态内容的主机img、video、download或ftp。 acl host_static hdr_beg(host) -i img. video. download. ftp. acl is_a hdr_beg(host) -i www.abc.test1 #判断域名是不是www.abc.test1,是则给与a服务器集群服务 acl is_b hdr_beg(host) -i www.abc.test2 #判断域名是不是www.abc.test2,是则给与a服务器集群服务 use_backend a_server if is_a use_backend b_server if is_b