apache adress based access control

Posted by stijn on Super User See other posts from Super User or by stijn
Published on 2011-01-05T10:53:24Z Indexed on 2011/01/05 11:55 UTC
Read the original article Hit count: 249

Filed under:
|

I have an apache instance serving different locations, eg

https://host.com/jira
https://host.com/svn
https://host.com/websvn
https://host.com/phpmyadmin

Each of these has access control rules based on ip adres/hostname. Some of them use the same configuration though, so I have to repeat the same rules each time:

Order Deny,Allow
Deny from All
Allow from 10.35 myhome.com mycollegueshome.com

Is there a way to make these reusable so that I don't have to change each instance everytime something changes? Ie, can I write this once, then use it for a couple of locations? Using SetEnvIf maybe? It would be nice if I could do something like this pseudo-config:

<myaccessrule>
  Order Deny,Allow
  Deny from All
  Allow from 10.35 myhome.com mycollegueshome.com
</myaccessrule>

<Proxy /jira*>
  AccessRule = myaccessrule
</Proxy>

<Location /svn>
  AccessRule = myaccessrule
</Location>

<Directory /websvn>
  AccessRule = myaccessrule
</Directory>

© Super User or respective owner

Related posts about apache

Related posts about apache2