我在 haproxy 中使用 consul 模板,并尝试根据 url 路径路由到不同的后端。我尝试使用 acl,但它似乎不起作用。这是我的 haproxy.cfg
defaults
mode http
frontend stats
bind *:1936
stats uri /
stats show-legends
no log
frontend http_front
bind *:80
default_backend emailHandler
acl emailservice path_beg /email
use_backend emailHandler if emailservice
backend emailHandler
balance roundrobin
server-template emailhandler-api 10 _emailhandler-api._tcp.service.consul resolvers consul resolve-opts allow-dup-ip resolve-prefer ipv4 check
resolvers consul
nameserver consul 127.0.0.1:8600
accepted_payload_size 8192
hold valid 5s
当我尝试访问 http://localhost/email 时,我得到 404。当我删除 acl 时,我的服务在 http://localhost 上运行
我将向 consul 注册更多服务,我只想使用一个具有不同 url 路径的公共入口点来处理不同的服务。 有人可以帮我解决这个问题吗?