httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Airat A. Sadreev" <>
Subject [users@httpd] Reverse proxy and cache
Date Fri, 10 Mar 2006 14:10:30 GMT
	I'd like to provide access to multiple remote Web-servers via my
Apache using reverse proxy. Remote Web-servers connected via low-speed
channels so I'd like to use \ caching to speed-up content loading for

	I set up reverse proxy and cache modules. The accessed files PUT
into cache but download speed was not increased. It seems that files is
reloaded every time when accessed and caching don't work actually.

This is an excerpt from my conf file

<IfModule cache_module>
	<IfModule disk_cache_module>
		CacheRoot c:/WebCache
	      CacheEnable disk /
		CacheMaxFileSize 10485760

RewriteCond %{HTTP_HOST}   !10\.234\.1\.15:?.* [NC]
RewriteRule ^/(.+)$
http://10\.234\.1\.15:8080/sdkuweb/proxy/%{HTTP_HOST}/$1 [P,L]

As you can see, RewriteRule redirects request through mod_proxy, so Apache
works as reverse proxy.

Apache IP address:

The request URL is http://mnd/sdku/tree.nvg Domain name mnd is defined on
client computer as Apache's IP ( As you can see, if the HOST
header field of request is other than Apache's IP (i.e. client requests file
from remote server), Apache redirects request.

As I stated above, file is successfully downloaded from remote web-server,
put into cache, but on subsequent requests the cached file not actially
I investigated mod_cache and mod_disk_cache under debugger.
Request processing flow is.
1.	cache_url_handler() is called. It, in one's turn, calls
	cache_generate_key_default() checks proxyreq field of request_rec
structure. Value of proxyreq field is 0 and hostname field of request_rec
structure is used. So cache key is http://mnd:80/sdku/tree.nvg?, which is
used to calculate hash value, which is used to generate path and file name
in cache.

2. 	Then request is redirected through mod_proxy, file is downloaded an
cache_save_filter() is called.
	cache_save_filter() calls cache_generate_key_default() as well. But
at this point value of proxyreq field is 2 (PROXYREQ_REVERSE) and
	cache_generate_key_default() tries to use parsed_uri.hostname field
as hostname. But URI is /mnd/sdku/tree.nvg and has no host field and 
	hostname is assigned value _default_. So cache key is
http://_default_:80/sdku/tree.nvg?, co the hash value for this key differs
from hash value on (1).

As we can see, because of different cache key values caching actually
doesn't work.

So where is the error: in my Apache configuration, in Apache code, or,
maybe, in my brains?


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