httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Gunton <>
Subject [users@httpd] Caching with reverse proxy apache 1.3.x, mod_proxy
Date Wed, 02 Apr 2003 18:31:39 GMT
Setup: RedHat 7.3, fully updated. Single machine, with two apache

  Front end: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6b
  Back end:  Apache/1.3.27 (Unix) mod_gzip/ mod_perl/1.27

Hi, I have set up my server to use mod_proxy as a reverse proxy front
end for mod_perl. There are two builds of apache, both on the same
machine. The purpose is to relieve load on the mod_perl server. The
front end serves all images and static pages, the mod_perl apache serves
all dynamic html pages. This is working just fine at the moment, but I
have never been able to get mod_proxy to cache any pages served from the
mod_perl server. I have set up all the variables specified in the
mod_proxy documentation (i.e. CacheRoot), but html pages do not get
cached. I have tried turning off mod_gzip, and made sure that the
mod_perl server is generating correct ContentLength and Expires headers.
But nothing ever gets cached. The reason I would like this is that some
of the pages on my sites are dynamic, but don't change much. They would
benefit from being cached at least for a while, so that the mod_perl
server doesn't have to regenerate them each and every time. This takes
load off the SQL server too, which also gets hit every time.

The proxy setup uses mod_rewrite to do the proxying:

  RewriteEngine On
  RewriteOptions 'inherit'
  RewriteRule \.(gif|jpg|png|ico|htm|cgi)$ - [last]
  RewriteRule ^/(.*)$ http://localhost:8080/$1 [proxy]
  ProxyReceiveBufferSize 131072

  # Reverse proxy cache does not work!
  CacheRoot "/www/vhosts/"
  CacheSize 1024

The mod_perl server then has the VirtualHost set up to catch the
forwarded requests. As I said, everything works perfectly except that
mod_proxy never caches anything.

The one clue I have is this: I have noticed during experimentation that
if I use a separate machine for the front end proxy, and forward the
mod_perl requests to the other machine, then it does seem to cache. So
does mod_proxy never cache anything that is coming from the same machine
(i.e. localhost)? If so then this looks like an oversight, since it can
be very useful to cache even local content if it is being dynamically

I know that there is a new caching module for Apache 2.0, but I am not
ready to upgrade yet and am otherwise quite satisfied with 1.3.x
currently. I am just wondering if there is some magic switch I can throw
for mod_proxy to cache mod_perl content coming from localhost. I have
tried changing the redirect to use the fully specified domain instead of
localhost, but that doesn't seem to work at all (I get a 404 error).

Any clues much appreciated. Thanks in advance,


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message