简体   繁体   中英

Apache HTTPD ProxyRemote and Balancer?

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?

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.

如果您在映射到平衡器的代理服务器上设置了另一个虚拟主机,然后通过

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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