Context : Apache2, mod_perl2, Tomcat, mod_jk1.2

In an Apache2/Tomcat5 setup, I have the following configuration directives :

<IfModule mod_jk.c>
# - URI's corresponding to calls to the X servlet are redirected to tomcat via the mod_jk module
        JkMount /xyz ajp13
        JkMount /xyz/* ajp13
</IfModule>

But, I would like some of the above URL request to be pre-processed by a mod_perl handler, like

<Location /xyz>
  SetHandler perl-script
  PerlResponseHandler My::module
  PerlSetVar anyvar "anyvalue"
</Location>

My::module would do something (or not) to the request, then it should let the (possibly modified) request go through, so that the mod_jk module can intercept it and re-direct it to Tomcat.

The problem is that I can *either* have one or the other configuration snippet above, but if I try both, then the request is always "short-circuited" by the mod_jk module (and re-directed to Tomcat), and the mod_perl handler is never executed. Or vice-versa I think, depending on which comes last.

I have found one solution, which is to install the mod_perl handler as a PerlAccessHandler, as such :

<Location /xyz>
  PerlAccessHandler My::module
  PerlSetVar anyvar "anyvalue"
</Location>

In this way, the mod_perl handler is executed in an earlier Apache phase than the mod_jk intercept. It works fine, but since the function of the module has basically not much to do with Access Control, I wonder if there is not a more elegant way to do this.

I guess it boils donw to the following more generic question :
Assuming that the Apache configuration would already specify some (non-perl) handlers for some Location, Directory or whatever, is there a way to "insert" mod_perl handlers in the chain, without overriding the other handlers ? And if yes, what does the mod_perl handler need to return to insure that the other handlers run also (OK, DECLINED,..) ?

Anyone has an idea ?

Thanks in advance
aw

Reply via email to