gpt4 book ai didi

docker - 发送代理在 ssl-passthrough haproxy 上失败

转载 作者:太空宇宙 更新时间:2023-11-03 14:32:13 28 4
gpt4 key购买 nike

我想在 Haproxy 上使用 ssl-passthrough 将流量路由到 traefik。这行得通,但是我想知道发出请求的人的 ip。 haproxy 文档说我必须使用发送代理。这适用于 http,但不适用于 https。 Traefik 启用了代理协议(protocol)。

Firefox 报告 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

最佳答案

这应该是 [entrypoints.https.proxyProtocol] 中的“https”,如:

[entryPoints.https]
address = ":443"

[entryPoints.https.tls]
[entryPoints.https.proxyProtocol]
trustedIPs = ["127.0.0.1/32", "private_ip"]

有关在 TOML 中使用表格的信息:https://github.com/toml-lang/toml#table

关于docker - 发送代理在 ssl-passthrough haproxy 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51684735/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com