Apache HTTPD ProxyRemote and Balancer?

巧了我就是萌 提交于 2019-12-12 05:32:48

问题


browser (IE) -> apache httpd proxy -> Proxy 1  -> target url
                                      Proxy 2  -> target url
                                      Proxy n  -> target url

So basically I want to make my own apache httpd proxy that works as a loadbalancer between choosing external proxy setup'ed in httpd conf.

Current setup:

 ProxyPreserveHost On
 ProxyRequests On
 ProxyVia On
 ProxyRemote * http://proxy_ip:80

This version works nicely but I can't figure out how to add several proxy's to ProxyRemote? ... seems not working when setuping as: ProxyRemote * balancer://mycluster

Any ideas? Can it be achieved with apache or some other load balancer should be used?


回答1:


Perhaps I'm a bit too late to help you, but it seems there is no clear answer elsewhere to your question, so this could be useful in the future.

Unfortunately the answer is you cannot achieve this kind of load balancing with Apache: as per the Apache documentation (https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyremote) the ProxyRemote directive only supports http and https schemas, not balancer://

Cannot really figure out why the Apache developers didn't consider this configuration, tough, since I found a patch for mod_proxy.c (http://apache-http-server.18135.x6.nabble.com/attachment/4777809/0/ProxyRemote-Balancer.patch) which seems to do the trick by essentially just adding the balancer:// schema to the list of matched protocols.




回答2:


Maybe it could work if you set up another vhost on the proxy server mapping to the balancer, then proxy to that vhost via

ProxyRemote * http://balancer-proxy.vhost.local


来源:https://stackoverflow.com/questions/36893927/apache-httpd-proxyremote-and-balancer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!