httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Airat A. Sadreev" <sa...@szmn.ru>
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
clients.

	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
	</IfModule>
</IfModule>

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: 10.234.1.15

The request URL is http://mnd/sdku/tree.nvg Domain name mnd is defined on
client computer as Apache's IP (10.234.1.15) 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
used.
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()
	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?

Thanks,
Airat
	


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message