10.22.12.54 haproxy IP 地址
10.22.12.55 Apache 网络 IP 地址
fqdn hasan.example.com 在 10.22.12.54 中解析
在我的 haproxy 配置中
global
log /dev/log local0
log /dev/log local1 notice
maxconn 100000
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
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
defaults
log global
mode tcp
maxconn 1000000
option httplog
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 Front-"443"
bind *:443
mode tcp
use_backend hasan
backend hasan
mode tcp
option ssl-hello-chk
server hasan 10.22.12.55:443 send-proxy-v2
APACHE 网络配置
<VirtualHost *:443>
ServerName hasan.example.com:443
DocumentRoot /var/www/html/
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel debug
SSLProxyEngine on
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/httpd/conf.d/ssl/cert.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/key.pem
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/ssl_access_hasan_log" combined
ErrorLog "logs/ssl_errors_hasan.log
</VirtualHost>
RemoteIPModule 配置
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.22.12.54
注意:
我的证书 CN 在 apache ServerName 指令中相同
我的证书和私钥位于
haproxy:/etc/ssl/certs/和/etc/ssl/private/
apache 网络:/etc/httpd/conf.d/ssl
在我观察的apache Log中
[2019 年 8 月 15 日星期四 11:36:23.368657] [ssl:info] [pid 4058] SSL 库错误:错误:140760FC:SSL 例程:SSL23_GET_CLIENT_HELLO:未知协议(protocol) - 不是 SSL 到 HTTPS 端口!? [Thu Aug 15 11:36:23.368660 2019] [ssl:info] [pid 4058] [client 10.22.12.54:41800] AH01998:与子 2 的连接关闭并异常关闭(服务器 hasan.example.com:443) [2019 年 8 月 15 日星期四 11:36:24.704663] [ssl:info] [pid 4056] [client 10.22.12.54:41804] AH01964:已建立与子 0 的连接(服务器 hasan.example.com:443) [2019 年 8 月 15 日星期四 11:36:24.704820] [ssl:info] [pid 4056] [客户端 10.22.12.54:41804] AH02008:握手中的 SSL 库错误 1(服务器 hasan.example.com:443) [2019 年 8 月 15 日星期四 11:36:24.704840] [ssl:info] [pid 4056] SSL 库错误:错误:140760FC:SSL 例程:SSL23_GET_CLIENT_HELLO:未知协议(protocol) - 不是 SSL 到 HTTPS 端口!?
注意:
没有发送代理一切正常。
但我需要使用
1) 在HAPROXY中使用TCP模式
2) HAPROXY 后端中的发送代理
3) Apache Web端的RemoteIP模块
最佳答案
来自 Base CentOS 7 repo 的最新版本(当我使用 yum install httpd 时) 不能理解 “远程 IP 代理协议(protocol)开启”
最新的 apt 存储库中的情况相同。
当我**从源代码**编译 apache httpd 时,我解决了这个问题。
关于apache - Haproxy "send-proxy"未知协议(protocol)——不是说 SSL 到 HTTPS 端口吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57506486/