关于域名和上下文名称的HA代理ACL

我有来自不同url的请求

https://example1.com/context1 https://example1.com/context2 https://example2.com/context1 https://example2.com/context2 

可能有多个具有多个上下文名称的域。 想要在HA代理中进行configuration并redirect到微粒backend 。 我可以在单行中使用域名和上下文名称,或者我们可以在HAProxy frontend嵌套acl吗?

好吧,让我们这样做:

 acl context_url url_reg -i -f /etc/haproxy/context_urls.list use_backend context_backend if context_url backend context_backend # your config here 

并在/etc/haproxy/context_urls.list文件中

 # regex for context urls /context\d