一、使用tcp监控端口
frontend https_443_in
bind 0.0.0.0:443
mode tcp
option tcplog
acl test_host hdr(host) -i www.test.com
use_backend logic-https if test_host
backend logic-https
mode tcp
balance roundrobin
server logic-01 172.31.1.2:443 check inter 2000 rise 3 fall 3 weight 1
server logic-02 172.31.1.3:443 check inter 2000 rise 3 fall 3 weight 1
二、使用https监控端口
frontend https
bind *:443 ssl crt /etc/ssl/haproxy-certs/www.test.com.pem crt /etc/ssl/haproxy-certs/www.test.cn.pem
mode http
reqadd X-Forwarded-Proto:\ https
option httpclose
option forwardfor
option http-server-close
capture request header Host len 255
capture request header User-Agent len 255
capture request header Referer len 255
capture request header Cookie len 255
acl test_host hdr(host) -i www.test.com www.test.cn
use_backend logic-http if test_host
backend logic-http
balance roundrobin
cookie SERVERID
server logic-01 172.31.1.2:80 check inter 2000 rise 3 fall 3 weight 1
server logic-02 172.31.1.3:80 check inter 2000 rise 3 fall 3 weight 1