ServerA服务的数据查询接口:/api/v1/datas HAproxy地址10.66.222.333
将ServerA添加转发规则添加到HAproxy
haproxy.cfg
frontend https_frontend
bind 0.0.0.0:6441
mode http
option tcplog
#default_backend https_backend
acl is_serverA path_beg -i /serverA # 目录分发
use_backend http_backend_A if is_serverA backend http_backend_A
mode http
balance roundrobin
stick-table type ip size 200k expire 30m
stick on src
server k1 192.168.0.139:6441 check inter 2000 fall 3
通过HAproxy请求ServerA的数据查询接口:
访问地址:10.66.222.333/serverA/api/v1/datas