我试图让我的Apache使用HTTPS请求的外部代理:
Listen 80 Listen 443 .. LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so .. SSLProxyEngine On SSLProxyVerify none SSLCACertificateFile conf/cert/curl-ca-bundle.cert ProxyRemote http://*.externaldomain.com:80 http://external.proxy.com:8585 ProxyRemote http://*.externaldomain.com:443 https://external.proxy.com:8585 ProxyPass /sub https://sub.externaldomain.com/
但对http:// localhost / sub / something的请求返回503,并给出:
[Fri Apr 15 17:38:15 2011] [error] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. : proxy: HTTPS: attempt to connect to 11.11.11.111:443 (sub.domain.com) failed
有什么奇怪的
curl -x 11.11.11.111:8585 https://sub.externaldomain.com/something
作品。
我怎样才能使Apache使用外部代理https请求?
你得到的错误是因为你最后一行进入configuration
ProxyPass /sub https://sub.externaldomain.com/
这告诉apache代理从/ sub到sub.externaldomain.com:443的传递请求,这是你实际得到你的错误信息。
现在你的设置丢失了
ProxyRequests On
因为ProxyRemote只在打开时运行,而用户代理(浏览器)configuration为使用Apache服务器作为代理。 我的理解是,你想做的事情是这样的:
1 – 将所有通信代理到/ sub通过您configuration的远程代理 – 但不能将本地apache服务器用作ProxyPass? – 如果是这种情况,删除最后一行
2 – 你希望你的apache服务器采取行动,它有本地资源/子,实际上这些请求是去远程服务器? – 如果是这种情况,你只需要configuration最后一行与专用端口,并使用此指令
ProxyPassReverse /sub https://sub.externaldomain.com/ # here configure the right port as you can see 443 is not working
我终于得到它的工作:)问题是(RTFM)
“匹配是远程服务器支持的URL模式的名称,或者应该使用远程服务器的部分URL,或者*表示应该联系所有请求的服务器。remote-server是一个部分URL为远程服务器“。
所以parsing很简单,用ProxyRemoteMatch代替:
ProxyRemoteMatch externaldomain\.com http://external.proxy.com:8585