10.22.12.54 haproxy IP地址

10.22.12.55 Apache Web 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 Web配置

<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:未知协议-不对HTTPS端口说SSL !!
[2019年8月15日星期四11:36:23.368660] [ssl:info] [pid 4058] [客户端10.22.12.54:41800] AH01998:由于中止关机而关闭了与子级2的连接(服务器hasan.example.com:443)
[2019年8月15日星期四11:36:24.704663 2019] [ssl:info] [pid 4056] [客户端10.22.12.54:41804]AH01964:建立了与子0的连接(服务器hasan.example.com:443)
[Thu Aug 15 11:36:24.704820 2019] [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:未知协议-不对HTTPS端口说SSL !!



注意:

没有send-proxy,一切都将正常运行。

但是我需要使用

1)在HAPROXY中使用TCP模式

2)HAPROXY BACKEND中的send-proxy

3)Apache Web端的RemoteIP模块

最佳答案

Base CentOS 7存储库的最新版本(当我使用yum安装httpd时)
不能理解
“ RemoteIPProxyProtocol开启”

最新的apt存储库中的情况相同。

当我**从源代码编译apache httpd时,我解决了这个问题。

09-18 11:13