我需要一些有关我的 HAProxy 配置的帮助。我目前正在使用 HAProxy 1.5 通过更改的 DNS 条目反向代理它们来访问受地理封锁的网站。(https://github.com/trick77/tunlr-style-dns-unblocking)。
现在我偶然发现了一个问题,因为我必须代理一台服务器的许多子域(比如说 abc.xyz.com、def.xyz.com、...)。是否可以使用 *.xyz.com 之类的东西为我的配置创建通配符,并且它实际上适用于 SNI 和该域的所有子域?
非常感谢您!
global
daemon
maxconn 200
user haproxy
group haproxy
stats socket /var/run/haproxy.sock mode 0600 level admin
log /dev/log local0 debug
pidfile /var/run/haproxy.pid
spread-checks 5
defaults
maxconn 195
log global
mode http
option httplog
option abortonclose
option http-server-close
option persist
option accept-invalid-http-response
timeout connect 20s
timeout server 120s
timeout client 120s
timeout check 10s
retries 3
# catchall ------------------------------------------------------------------------
frontend f_catchall
mode http
bind *:80
log global
option httplog
option accept-invalid-http-request
capture request header Host len 50
capture request header User-Agent len 150
#--- xyz.com
use_backend b_catchall if { hdr(host) -i abc.xyz.com }
default_backend b_deadend
backend b_catchall
log global
mode http
option httplog
option http-server-close
#--- xyz.com
use-server abc.xyz.com if { hdr(host) -i abc.xyz.com }
server abc.xyz.com abc.xyz.com:80 check inter 10s fastinter 2s downinter 2s fall 1800
frontend f_catchall_sni
bind *:443
mode tcp
log global
option tcplog
no option http-server-close
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
#--- abc
use_backend b_catchall_sni if { req_ssl_sni -i abc.xyz.com }
default_backend b_deadend_sni
backend b_catchall_sni
log global
option tcplog
mode tcp
no option http-server-close
no option accept-invalid-http-response
#---xyz.com
use-server abc.xyz.com if { req_ssl_sni -i abc.xyz.com }
server abc.xyz.com abc.xyz.com:443 check inter 10s fastinter 2s downinter 2s fall 1800
# deadend ------------------------------------------------------------------------
backend b_deadend
mode http
log global
option httplog
backend b_deadend_sni
mode tcp
log global
option tcplog
no option accept-invalid-http-response
no option http-server-close