On Wed, Aug 29, 2001 at 01:31:54PM -0400, Vivek Khera wrote:
> I've got the classic lightweight front end proxying to the mod_perl
> heavyweight backend.  I use proxy_add_forward on the front end and the
> PerlPostReadRequest handler to set $r->hostname and $r->remote_ip.
> 
> This all works excellently.  My question, however, is this too late
> for the name-based virtual hosts to trigger?  In my mod_perl app, I
> need to trigger different things based on the virtual site.  What I
> want to do is this:
> 
> <VirtualHost localhost>
>  ServerName www.mailermailer.com
>  PerlSetVar SiteID 7
>  PerlSetVar SiteName www.mailermailer.com
> </VirtualHost>
> 
> <VirtualHost localhost>
>  ServerName m1e.net
>  PerlSetVar SiteID 1
>  PerlSetVar SiteName m1e.net
> </VirtualHost>
> 
> in the backend.
> 
> However, it seems that it always picks up the first virtual host
> defined this way, regardless of what the post read request handler
> sets $r->hostname to.
> 
> Is there some other trick I should try?  I'm working from home today
> and don't have my Eagle book handy...
> 
> If I can't get it to work with name virtual hosts, I'll have to go to
> port-based virtual hosts, which I'd prefer to avoid since I expect to
> have several hundred of these eventually.

It seems that everything concerning vhosts is set up in http_protocal.c
and that the vhost is set right after Apache has read the request from 
the client and then calling ap_update_vhost_from_headers to actually
determine the vhost. All this happens before your module gets to run.
It might be possible to create a C module that sets the Host: header 
like you want it to be and then call ap_update_vhost_from_headers.

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> 

Reply via email to