perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <>
Subject Re: Configuring virtual hosts on the fly
Date Mon, 12 Oct 2009 11:34:20 GMT
On Sun 11 Oct 2009, André Warnier wrote:
> > I see some hooks in PerlTransHandler and PerlMapToStorageHandler
> > that seem like they can almost do what I want, but I don't see how
> > to set other virtual host parameters, like ServerAdmin
> , UseCanonicalName,
> > etc.
> >
> > I'm just starting to work on this, and I thought I would see if
> > anybody had tried anything similar before and had some suggestions
> > for what to do, or what not to do.
> I have never tried this myself, but the mod_perl 2.x documentation
> contains some hints that leads to believe that it should be possible.

Some things could work this way, others definitely will not. For example 
you cannot create an IP based vhost on demand. You cannot create log 
files on the fly. Well, you can but you cannot create them as root as 
it is done during startup.

In general its not a good idea to mess with things that are not marked 
as applicable in directory context for the following reason. Firstly, 
you have to make sure to reset them when you request is done. See the 
implementation of $r->document_root for example. And secondly, in a 
threaded environment changing those values in one thread can affect the 
behavior of other requests in other threads because they are shared.

UseCanonicalName is applyable in directory context. So, you can safely 
set it via $r->add_config. It may however be useless to set it in a 
translation or map2storage handler because if you have a directory or 
location container or even a .htaccess file that sets the directive it 
overwrites anything set in a translation handler. Best phase to do that 
is probably fixup.

ServerAdmin is valid only in server config and virtual host context 
( So I 
wouldn't mess with that. Better create custom error pages.


Need professional mod_perl support?
Just hire me:

View raw message