all the vhost stuff is done before the post_read_request (see
ap_read_request()).

-dean

On Fri, 13 Apr 2001, Ask Bjoern Hansen wrote:

> Hi,
>
> ARgh, excuse me for the low cluerate. I've spend hours without
> getting anything to work now so I am asking for a little hint.
>
> I want my Apache to find the VirtualHost based on the X-ServerName
> header (sent from my proxy) instead of the Host header. Sounds
> simple enough, no?
>
> So I've configured apache like:
>
> ...
> Listen 127.0.0.1:8360
> NameVirtualHost *
>
> <virtualhost _default_>
>     ServerName dev.site1.com
>     ServerAlias site1.develooper.com
>     PerlSetVar site site1
>     DocumentRoot /home/web/htdocs/site1/
> </virtualhost>
>
> <virtualhost _default_>
>     ServerName  dev.site2.com
>     ServerAlias site2.develooper.com
>     PerlSetVar site site2
>     DocumentRoot /home/web/htdocs/site2/
> </virtualhost>
> ...
>
> I have a mod_perl PostReadRequest handler that among other things does
> this:
>
>   my $host = $r->header_in('X-ServerName');
>   $r->hostname($host) if $host;
>
>
> so when I do a request for http://site2.develooper.com/ it goes nicely
> through the proxy and get the right X- header set to dev.site2.com and
> such, but the backend httpd (with the above configuration) doesn't
> pick up the virtualhost.
>
> So one of two:
>
>   The virtualhost is picked before PostReadRequest is being invoked.
>
>   My <virtualhost ...> configuration isn't right.
>
> The basic goal is to work around mod_proxy setting the Host header to
> Host: localhost:8360. (Maybe it could be accomplished in a simpler
> way :-/ ).
>
>
>  - ask
>
> --
> ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
>
>

Reply via email to