我有一个域int.business.com。当我点击此按钮时,我希望浏览器在www.data.business.com域中显示内容,但用户仍应在地址栏中看到int.business.com。这是我的虚拟主机配置
RewriteEngine on
SSLProxyEngine on
RewriteRule ^/(.*)$ int.business.com [P]
ProxyPassReverse / data.newbusiness.com
使用此配置,我收到502代理错误
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.
Reason: Error reading from remote server
有关如何解决此问题的任何建议。
答案 0 :(得分:0)
您应该像这样修改您的配置:
ProxyPass "/" "http://www.data.business.com"
ProxyPassReverse "/" "http://www.data.business.com"
第一个参数是您要代理的参数,第二个参数是该代理的目标。
SSLProxyEngine
不是必需的,因为您始终不代理SSL。
使用RewriteRule
进行代理是可以的,但是使用ProxyPass可以提高性能(由于持久连接)。看到:
https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_p了解更多详情。
此外,您在这里不使用任何复杂的正则表达式,因此就足够了。
确保加载模块mod_proxy,mod_proxy_http。