我使用 haproxy 和 stunnel 处理 SSL(并使用代理模式来保留 haproxy 的原始 IP)。
我有几个 acl 测试,根据域、标头或路径重定向到不同的后端。
问题是,无论您是通过 http 还是 https 进入,这些都是相同的,但我必须在配置中复制它们。有什么办法可以减少重复吗?
这是一个示例配置:
global
user haproxy
group haproxy
#etc...
frontend http-in
bind *:80
acl files_path path_beg /files/
acl beta_host hdr_beg(host) -i beta.
use_backend files if files_path
use backend beta_host
default_backend appservers
frontend https-in
bind *:442 accept-proxy
acl files_path path_beg /files/
acl beta_host hdr_beg(host) -i beta.
use_backend files if files_path
use backend beta_host
default_backend appservers
backend appservers
balance roundrobin
option forwardfor
server appserver_1 localhost:8080 weight 1 …Run Code Online (Sandbox Code Playgroud)