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>
link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

You're after mod_macro.

http://cri.ensmp.fr/~coelho/mod_macro/

link|improve this answer
exactly what I'm after. Thanks! – stijn Jan 5 '11 at 11:10
feedback

If you're already using mod_perl, remember that mod_perl wraps the config bits of Apache as well as the data serving bits.

http://perl.apache.org/start/tips/config.html

link|improve this answer
interesting as well. Unfortunately my perl skill level is like zero :] – stijn Jan 5 '11 at 17:02
feedback

Your Answer

 
or
required, but never shown

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