My configuration had a similar problem - 
a bunch of virtualhosts (~25 or so) some of which use modperl, running on
a handful of 2-node tightly-coupled clusters with the content/scripts
sitting on NFS.

DNS for the virtualhost addresses points to a frontend cluster. I set up
extra aliases for my backend virtualhost addresses in the /etc/hosts files
on both the frontend and the backend servers.
dns:         www.glurp.com -> my.frontend.address
/etc/hosts:  glurp1        -> my.backend1.address
/etc/hosts:  glurp2        -> my.backend2.address
...for all services

The virtualhosts on the backend respond to the aliases in the /etc/hosts
file and serve dynamic content.

frontend writes /perl/ and /cgi-bin/ requests to a
random-selection RewriteMap of the backend servers for that service.

also at the frontend I took mod_proxy_add_forward.c and added another
header. My module now adds
X-Forwarded-For: remote.address    # remote address of client
X-Host: www.glurp.com              # real virtualhost address

The reason I used the X-Host header was to avoid
missing-trailing-slash requests coming back to the client with the wrong
(/etc/hosts aliased) virtualhost in the Location: response header.

I have a mod_perl handler at the backend which intercepts 301 Moved
Permanently requests which are usually thrown by missing-trailing-slash
requests and rewrites the Location response header using the X-Host
request header.

I don't know whether there's a nice way to do this but it works relatively
well.

Thoughts welcome..
R.

On Mon, 3 Dec 2001, Tyler 'Crackerjack' MacDonald wrote:

> [mod_perl list: i'm not a subscriber jsyk so if you wish to reply to me,
> reply to me directly and not the list]
> 
> This past weekend, my webserver suffered a severe failure when i decided to
> upgrade my code to mod_perl instead of fastCGI. This performance problem
> resulted in me going to the mod_perl performance tuning guide. Reading this
> guide made me think "damn, that's inconvienent for a bunch of VHosts".
> Thinking this made me write the following artice:
> 
> http://www.weedns.com/apache_tuning/fast_mod_perl_mini_howto.html
> 
> It uses wildcard DNS and some other goodies to extend the
> mod_perl-server-via-proxy-from-static-server setup that is already partially
> documented in the performance tuning and general guides on the
> perl.apache.org website.
> 
> It's relevant to apache 1.3 because I got an even bigger headache trying to
> make modperl2+apache2 run.
> 
> Feel free to link to it or integrate it's ideas into your own documentation
> if you wish.
> 
> Cheers,
> Tyler
> 
> -- 
> Early to bed and early to rise and you'll be groggy when everyone else is
> wide awake.
> 

Reply via email to