关于主机部分www的问题:
case 1:
frontend web_service
bind *:80
bind *:443 ssl crt /etc/haproxy/cert.pem
acl wwwpod100_com hdr_beg(host) -i zjtest7.com
use_backend wwwpod100_com if wwwpod100_com
backend wwwpod100_com
mode http
server apphost_1 192.168.32.101:3000 check inter 2000 fall 3
mojo 接口:
get '/scan/test' => sub {
my $c = shift;
$c->render(text => "welcome wxpod999" );
};
zjtest7-haproxy:/etc/haproxy# curl http://zjtest7.com/scan/test
welcome wxpod999zjtest7-haproxy:/etc/haproxy#
zjtest7-haproxy:/etc/haproxy#
zjtest7-haproxy:/etc/haproxy# curl zjtest7.com/scan/test
welcome wxpod999zjtest7-haproxy:/etc/haproxy#
加上www呢?
zjtest7-haproxy:/etc/haproxy# curl www.zjtest7.com/scan/test
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
此时请求不到
case 2:
acl wwwpod100_com hdr_beg(host) -i www.zjtest7.com
use_backend wwwpod100_com if wwwpod100_com
backend wwwpod100_com
mode http
server apphost_1 192.168.32.101:3000 check inter 2000 fall 3
zjtest7-haproxy:/etc/haproxy# curl http://zjtest7.com/scan/test
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
zjtest7-haproxy:/etc/haproxy# curl zjtest7.com/scan/test
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
zjtest7-haproxy:/etc/haproxy# curl www.zjtest7.com/scan/test
welcome wxpod999zjtest7-haproxy:/etc/haproxy#
此时必须加上www才行