Linux – How to Exclude an URL for Apache Mod_proxy

apache-2.2linuxmod-proxymod-rewritetomcat

We have two Apache server as front-end and 4 tomcat server as back-end configured using mod_proxy module as load balancer. Now, we want to exclude an single tomcat url from the mod_proxy load balancer. Is there any way or rule to exclude?

Proxy Balancer Setting:

<Proxy balancer://backend-cluster1>
   BalancerMember http://10.0.0.1:8080 loadfactor=1 route=test1 retry=10
   BalancerMember http://10.0.0.2:8080 loadfactor=1 route=test2 retry=10
</Proxy>

Best Answer

You exclude paths from mod_proxy with an exclamation mark (!) before your full ProxyPass statement, which your sample is missing - It would look something like ProxyPass /path balancer://backend-cluster1. Therefore, to exclude a path, add:

ProxyPass /my/excluded/path !

before

ProxyPass /my balancer://backend-cluster1