tyl*_*erl 66 ssl proxy proxypass apache-2.2
我想通过非 SSL 站点代理来自 SSL 站点的请求。我的 Apache httpd.conf 如下所示:
<VirtualHost 1.2.3.4:80>
ServerName foo.com
ProxyPass / https://bar.com/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
因此,当我访问http://foo.com 时,我希望 apache 向https://bar.com发出请求并将其获取的页面发送给我。
相反,我收到了 500 错误,在错误日志中,我看到:
[error] proxy: HTTPS: failed to enable ssl support for 4.3.2.1:443 (bar.com)
Run Code Online (Sandbox Code Playgroud)
大概我在这里遗漏了一个指令。可能是哪个?
别介意安全隐患。我完全理解其中的风险。
Sam*_*cke 82
您将需要mod_ssl,mod_proxy并且可以选择mod_rewrite。根据您的发行版和 Apache 版本,您可能还需要检查mod_proxy_connect和mod_proxy_http是否已加载。
启用 SSL 代理支持的指令在 mod_ssl 中:
<VirtualHost 1.2.3.4:80>
ServerName foo.com
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
ProxyPass / https://secure.bar.com
ProxyPassReverse / https://secure.bar.com
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
IIRC 您还可以使用:
RewriteRule / https://secure.bar.com [P] # don't forget to setup SSLProxy* as well
Run Code Online (Sandbox Code Playgroud)