Hi all,
I ran in to a problem using NameWithVirtualHost because I used Rewrite rules based on the host name inside a single virtual host and so ended up with, in my case:
http://www.interarchy.com/main/index.pl and http://www.stairways.com/main/index.pl
going to different files in the file system, but both in the same virtual host (because they share most of the site, only the main entry is different).
Anyway, the Apache::Registry bases the cache/Package name on the virtual host name and the path of the URL. I don't really know why it isn't based on the full disk pathname, but anyway, this wasn't sufficient for my purposes, so I added support for using the hostname instead of the virtual server name:
--- Registry.pm.orig Tue Jun 15 20:55:32 2004 +++ Registry.pm Wed Jun 16 21:02:38 2004 @@ -20,6 +20,9 @@ unless (defined $Apache::Registry::NameWithVirtualHost) { $Apache::Registry::NameWithVirtualHost = 1; } +unless (defined $Apache::Registry::HostNameWithVirtualHost) { + $Apache::Registry::HostNameWithVirtualHost = 0; +} unless (defined $Apache::Registry::MarkLine) { $Apache::Registry::MarkLine = 1; } @@ -75,7 +78,10 @@
$script_name =~ s:/+$:/__INDEX__:;
- if ($Apache::Registry::NameWithVirtualHost && $r->server->is_virtual) {
+ if ($Apache::Registry::HostNameWithVirtualHost && $r->server->is_virtual) {
+ my $name = $r->hostname;
+ $script_name = join "", $name, $script_name if $name;
+ } elsif ($Apache::Registry::NameWithVirtualHost && $r->server->is_virtual) {
my $name = $r->get_server_name;
$script_name = join "", $name, $script_name if $name;
}
This is for mod_perl 1.0. I saw that mod_perl 2.0 does things slightly differently, but essentially has this same functionality. Anyway, I'm sending this to for consideration. The downside of by-host is that hosts like www.interarchy.com and interarchy.com would be treated differently. The upside is it works even in the case I've got. It'd be nice not to have to patch mod_perl with each install I do, so if this might be generally useful then perhaps it could be incorporated.
Thanks for your time, Peter.
-- I will be away until June 20, and then again from June 26-July 6. <http://www.interarchy.com/> <http://download.interarchy.com/>
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html