我遵循这个指南: http : //hints.macworld.com/article.php?story=20041129143420344
这是我的虚拟主机定义
<VirtualHost *:443> SSLEngine on SSLProxyEngine On RequestHeader set Front-End-Https "On" CacheDisable * SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL DocumentRoot "/Users/me/projects/myproject/public" ServerName ssl.mydomain.com ServerAlias *.ssl.mydomain.com SSLCertificateKeyFile "/private/etc/apache2/certs/webserver.nopass.key" SSLCertificateFile "/private/etc/apache2/certs/newcert.pem" SSLCACertificateFile "/private/etc/apache2/certs/demoCA/cacert.pem" SSLCARevocationPath "/private/etc/apache2/certs/demoCA/crl" ErrorLog "/Users/me/Desktop/ssl.log" ProxyPass / https://localhost:3002/ ProxyPassReverse / https://localhost:3002 ProxyPreserveHost on </VirtualHost>
而当我尝试连接到sevre viov的网页浏览器,我得到这个错误:
[Thu Feb 02 16:50:40 2012] [error] (502)Unknown error: 502: proxy: pass request body failed to 127.0.0.1:3002 (localhost) [Thu Feb 02 16:50:40 2012] [error] [client 96.11.81.39] proxy: Error during SSL Handshake with remote server returned by /session/new [Thu Feb 02 16:50:40 2012] [error] proxy: pass request body failed to 127.0.0.1:3002 (localhost) from 96.11.81.39 ()
我该如何debugging/解决这个问题?
添加到vbartoni的答案,似乎从Apache 2.4和以上,有不同的默认值和一个新的指令。
我正在运行的Apache 2.4.6,我不得不添加以下指令,以使其工作:
SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off
不要在前端和后端服务器之间使用HTTPS,对于localhost连接启用SSL没有意义。
为了澄清,使用ProxyPass / http://localhost:3002/而不是ProxyPass / https://localhost:3002/
或者,如果您确实想要使用SSL连接您的反向代理服务器到后端服务器(当服务器不在Apache Httpd反向代理服务器上时,这个服务器通常很有用),除了https://backend-server-address ,请使用SSLProxy*指令来设置CA证书,如mod_proxy文档的介绍中所述 。 特别是,您需要configurationSSLProxyCACertificateFile ,并确保后端服务器的证书发布到正确的主机名, 如Apache Httpd所示 (即您的localhost )。
如果您没有使用SSL连接到后端服务器,则可能无法检测到您实际使用的是SSL并将其configuration为强制您转到SSL(因此无限redirect)。 您可能希望查看类似于Jetty使用其forwarded选项的机制 (以便能够告诉后端在代理之后)。 Rails可能会默认解释X-Forwarded-Proto 。 在这种情况下,将其添加到您的Apacheconfiguration(在SSL虚拟主机中):
RequestHeader set X-Forwarded-Proto 'https'
例如,这里似乎也有类似的问题。
我有一个类似的问题(相同的错误日志),除了代理转发https通信到另一个主机。
由于我懒惰,主人在我自己的孤立的networking,这些指令解决了这个问题:
SSLProxyVerify无
SSLProxyCheckPeerCNclosures
如果后端服务器使用过时的自签名证书,则需要另外一个选项(如果没有对后端服务器的访问):
SSLProxyCheckPeerExpireclosures