我正在尝试设置HAProxy,以便基于SNI对不同后端进行简单的tcp传输。然而,如果我这样做的话,我对我的客户有严重的问题:
如果我直接与后端联系,绕过HAProxy,我就没有这样的问题。因此,HAProxy中的某些内容配置不正确,但我看不出它是什么。
技术细节:
我的配置如下所示:
global
# NOTE: Could be a security issue, but required for some feature.
uid 80
gid 80
chroot /var/haproxy
daemon
stats socket /var/run/haproxy.socket group proxy mode 775 level admin
nbproc 1
nbthread 1
tune.ssl.default-dh-param 1024
spread-checks 0
tune.chksize 16384
tune.bufsize 16384
tune.lua.maxmem 0
log /var/run/log local0 info
defaults
log global
option redispatch -1
timeout client 30s
timeout connect 30s
timeout server 30s
retries 3
# Frontend: https_passthrough (https tcp mode main ip)
frontend https_passthrough
bind x.x.x.x:443 name x.x.x.x:443
mode tcp
# tuning options
timeout client 30s
# logging options
# ACL: service_sni
acl acl_5f34555b7fae76.76760871 req.ssl_sni -i service.example.com
# ACTION: service_https_passthrough
use_backend service_https_passthrough if acl_5f34555b7fae76.76760871
# WARNING: pass through options below this line
tcp-request inspect-delay 10s
# Backend: service_https_passthrough ()
backend service_https_passthrough
# health checking is DISABLED
mode tcp
balance source
# stickiness
stick-table type ip size 50k expire 30m
stick on src
# tuning options
timeout connect 30s
timeout server 30s
server service_https_passthrough 10.0.1.105:443如果连接失败,我会找到类似的条目
https_passthrough https_passthrough/<NOSRV> -1/-1/0 0 SC 1/1/0/0/0 0/0在原木上。但是,正如我所说的,后端服务器每天24小时运行,在内部局域网(这里还涉及路由/防火墙/VLAN)上工作一整天都很好,所以我怀疑这是防火墙问题。
任何帮助都很感激。
发布于 2020-08-13 13:09:38
看起来,将这两行添加到前端配置为我解决了这个问题:
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }是从HAProxy博客文章上提取的。
https://serverfault.com/questions/1029930
复制相似问题