ProxyPass HTTPS 到其他服务器

cor*_*nuz 5 mod-proxy mod-ssl apache-2.4

我有一台frontend.example.com带有公共 IP的服务器。Apache (2.4) 应该代理service1.example.com(DNS 别名为frontend.example.com)的流量。

service1.example.com是位于192.168.56.0两者之间的专用 LAN ( )上的 VM 。

现在,这对 HTTP 来说很容易:

<VirtualHost *:80>
        ServerName service1.example.com

        ProxyPass / http://192.168.56.2/
        ProxyPassReverse / http://192.168.56.2/

        <Location "/">
                Require all granted
        </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我正在尝试为 HTTPS 做同样的事情:

<VirtualHost *:443>
        ServerName service1.example.com

        SSLEngine On
        SSLProxyEngine On
        ProxyRequests Off
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerExpire off
        SSLInsecureRenegotiation on
        SSLProxyVerify none
        SSLVerifyClient none
        SSLCertificateFile /etc/ssl/certs/example_com.crt
        SSLCertificateKeyFile /etc/ssl/certs/example_com.key

        ProxyPass / https://192.168.56.2/
        ProxyPassReverse / https://192.168.56.2/

        <Location "/">
                Require all granted
        </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

尝试service1.example.com通过 HTTPS访问返回:与远程服务器的 SSL 握手期间出错

安全不是我在这里关心的问题。service1 需要HTTPS 连接到它的一些服务,这就是为什么我不是简单地将 HTTPS 代理到 HTTP。我不想frontend.example.com参与 SSL。我想要的是它说“嘿,我在 443 上有一个连接,我没有处理它,我只是将它转发到这个内部 IP,它会处理它”。我只是想让它传递请求。可以做到吗?

正如您在上面的 HTTPS 配置中看到的那样,我已尝试尽可能地放宽安全性(例如SSLInsecureRenegotiation on,假设要降低对中间人攻击的壁垒,不是吗?)。但到目前为止没有任何效果。

cor*_*nuz 2

显然我唯一缺少的指令是SSLProxyCheckPeerName off. 现在可以了。