title: conditional proxypass ajp rules using ip whitelist
body: <p>I've successfully created a ProxyPass ajp rule which works fine, but now i want to restrict the access of certain urls using an ip-whitelist. In other words, when someone comes from an ip that is not on the whitelist the request should not be proxypassed (and, ideally, some sort of access denied should be issued)</p>
  
  <p>i don't have control over the machine i'm proxy-passing to, so i can't put the ip-whitelist on that machine's configuration. That's why i'm trying to configure this on the same machine that has the proxypass rule.</p>
  
  <p>Defining a &lt;Location /path&gt; with 'Allow from'-rules doesn't work, because the request is still proxypassed. I guess this simply means the proxypass rules preceed the location-rules.</p>
  
  <p>I've tried to work around it by setting an environment variable depending on the remote-address <em>(because then i could proxy non-whitelist-ips to nonexistent url - not pretty, but it would achieve the goal)</em>, but it seems the proxypass rule doesn't work with environment variables. Something as simple as this:</p>
  
  <pre><code>SetEnv custom_proxypath=/
  ProxyPass %{ENV:custom_proxypath} ajp://10.50.40.21:8009/
  ProxyPassReverse %{ENV:custom_proxypath} ajp://10.50.40.21:8009/
  </code></pre>
  
  <p>doesn't work. while </p>
  
  <pre><code>ProxyPass / ajp://10.50.40.21:8009/
  ProxyPassReverse / ajp://10.50.40.21:8009/
  </code></pre>
  
  <p>works perfectly.</p>
  
  <p>I'm out of options. Does anyone else have a suggestion how to approach this?</p>