简体   繁体   English

如何在Apache上针对特定网址使用反向代理?

[英]How to use reverse proxy on apache for a specific url?

I have a load balancer that balances 2 servers A & B on the cloud both of which have apache running on them. 我有一个负载平衡器,用于平衡云上的两个服务器A和B,这两个服务器上都运行着Apache。 A & B can serve all the requests except search which is powered only by A. The search request is through http://example.com/search . 除了仅由A支持的搜索,A&B可以满足所有请求。搜索请求是通过http://example.com/search If B was to receive such a request, how can I forward this request to A and the serve the response received from server A to client? 如果B收到了这样的请求,我该如何将该请求转发给A并将从服务器A收到的响应提供给客户端?

PS: I am running Ruby on Rails. PS:我正在运行Ruby on Rails。

Apache's ProxyPass directive seems to do what you're asking for. Apache的ProxyPass指令似乎可以满足您的要求。

You could do something like this in server B configuration: 您可以在服务器B配置中执行以下操作:

ProxyPass /search http://server-A.example.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM