I'm hosting multiple instances of the same web app in different versions using the same instance of HTTPd and one VHOST
per instance/version of web app currently. I would like to use mod_perl's PostConfigRequire
to implement a handler pre-loading all those instances during server startup instead of relying on mod_perl's registry-facilities per request, as is done currently. The latter breaks in case of too many concurrent requests and according to some tests, that problem doesn't occur anymore in case things get pre-loaded.
Because of the different versions of my web app, I need to use PerlOptions +Parent
to provide each VHOST
with its individual Perl interpreter pool. Additionally I can easily configure PerlPostConfigRequire
per VHOST
, but pre-loading needs to take into account which VHOST
that handler is currently executed in. Within that handler I need to only load those files associated with some concrete VHOST
.
The problem is that I'm having trouble how to find the VHOST
currently executing that handler. In that past I have implemented something similar per request by looking at the currently requested URL and comparing that to VHOST
configs, but I don't have a request now. Apache2::ServerUtil->server()
is not providing my VHOST
, but it's available at all e.g. using Apache2::Directive::conftree()->lookup('VirtualHost')
. Only that I don't know which one is the one containing PerlPostConfigRequire
currently executed. I'm pretty sure that PerlPostConfigRequire
really gets executed per VHOST
, because I get debugging output scaling with the number of VHOST
s configured as well.
Any ideas? Thanks!