反向代理 SNI 不匹配的 Apache 远程代理

gre*_*ero 6 reverse-proxy mod-proxy proxypass sni apache-2.2

我们设置的 Apache-2.2 和通过另一台设备代理的反向代理存在问题。

流程是:Apache A -> proxy.abc.net -> Apache B

我们在 Apache B 上得到的错误是

通过 SNI 提供的主机名 proxy.abc.net 和通过 HTTP 提供的主机名 backend.abc.net 不同

当前配置

    <VirtualHost frontend.abc.com:80>

    ServerName frontend.abc.com

    SSLEngine on
    SSLOptions +StrictRequire
    SSLProtocol -all +TLSv1
    SSLHonorCipherOrder On
    SSLCipherSuite RC4-SHA:HIGH:!ADH:!MD5
    SSLCertificateFile conf/certs/cert.cer
    SSLProxyCACertificateFile certs/proxy.cer
    SSLCertificateKeyFile conf/certs/cert.pem
    SSLCertificateChainFile conf/certs/chain.cer


    DocumentRoot /foo/bar

    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost off
    ProxyErrorOverride On
    SetEnv proxy-sendchunked 1

    ProxyRemote "*"  https://proxy.abc.net:8080
    ProxyPass  /foo  https://backend.abc.net:8888/foo  disablereuse=on

</Virtual Host>
Run Code Online (Sandbox Code Playgroud)

添加

SSLProxyProtocol SSLv3
Run Code Online (Sandbox Code Playgroud)

有效,因为它不进行 SNI 检查,但 SSLv3 不是我们必须使用 TLSv1 或更高版本的选项。

小智 1

Apache 2.2 对此检查进行了硬编码(比较 SNI 主机名和 Host 主机名)。

Apache 2.4 放宽了此条件,并且仅在以下情况下失败:

        * The request does not select the virtual host that was
        * selected by the SNI and its SSL parameters are different
Run Code Online (Sandbox Code Playgroud)

https://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/ssl/ssl_engine_kernel.c?view=annotate#l335

所以答案是升级到2.4。