【发布时间】:2018-08-04 10:36:05
【问题描述】:
我想在 Haproxy 上使用 ssl-passthrough 将流量路由到 traefik。 这可行,但是我想知道提出请求的人的 ip。 haproxy 文档说我必须使用 send-proxy。这适用于 http,但不适用于 https。 Traefik 已启用代理协议。
火狐报告SSL_ERROR_RECORD_OVERFLOW_ALERT
Chrome 说 ERR_SSL_PROTOCOL_ERROR
Traefik 日志显示:
msg="http: TLS handshake error from haproxy_ip:51206: tls: oversized record received with length 22617"
我是否遗漏了配置中的某些内容?
我的 haproxy 配置:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
option tcplog
mode tcp
timeout connect 1s
timeout client 20s
timeout server 20s
timeout client-fin 20s
timeout tunnel 1h
#option httplog
#option dontlognull
#timeout connect 5000
#timeout client 50000
#timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend http_front
bind *:80
option http-server-close
option forwardfor
default_backend http_back
backend http_back
balance roundrobin
server private_server private_ip:80 send-proxy
frontend https_front
bind *:443
mode tcp
option tcp-check
default_backend https_back
backend https_back
balance source
mode tcp
option ssl-hello-chk
server private_server private_ip:8080 send-proxy
Traefik 配置:
debug = false
logLevel = "DEBUG"
defaultEntryPoints = ["https","http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.http.proxyProtocol]
trustedIPs = ["127.0.0.1/32", "private_ip"]
#insecure = true
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "dartsresults.nl"
watch = true
exposedByDefault = false
【问题讨论】:
-
您能分享一下您设置端点和代理协议的 Traefik 配置部分吗?
-
@NickRamirez 我添加了 Traefik 配置
标签: docker ssl haproxy traefik