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 loadfactor=1 route=test1 retry=10
   BalancerMember loadfactor=1 route=test2 retry=10

3 Answers 3


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 !


ProxyPass /my balancer://backend-cluster1
  • But the url to have access behind the proxyBalancer
    – Mughil
    Jun 26, 2013 at 13:32
  • Thanks fuzzyfelt, I am asking how to exclude the url if we configured the proxy balancer. I have included the proxy configuration in the question
    – Mughil
    Jun 26, 2013 at 14:29
  • 1
    See updated answer. Add an exclusion before you define which path to proxypass. Jun 26, 2013 at 15:03
  • 2
    Using this answer worked great for allowing LetsEncrypt into the default .well-known folder location for a virtualhost, when using ProxyPass to show a chat server there. Add before the other directives: ProxyPass /.well-known ! Aug 30, 2017 at 14:51

In addition to Alastair McCormack answer: If you use <Location>, you need to put the exception below instead of before:

<Location /my/>
    ProxyPass balancer://backend-cluster1

<Location /my/excluded/path/>
    ProxyPass !

You could put a rewrite above the proxy directives that will give users a 404 error when they try to access the url you want to exclude. You will need to enable rewrite_module.

<Location ~ ^/urltoblock($|/)>
   RewriteEngine On 
   RewriteRule .* - [L,R=404]
  • He didn't say anything about wanting a 404 error.
    – user207421
    Oct 2, 2014 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.