Hi all,

I needed to reverse proxy IIS (with modified FlatCompression ISAPI filter, 
which dont cache), cache it on disk and uncompress for clients that dont 
Accept-Encoding: gzip. I've finally managed to set up all these mods together. 
Suprisingly it works w/o mod_rewrite and SetEnvIf. Here's my httpd.conf:

<httpd.conf>
[...]
#
# - reverse proxy gzipped data from IIS
# - disk cache it
# - inflate for clients not sending `Accept-Encoding: gzip` header
#
# Based on fact (bug?), that when request is served from cache (quick_handler)
# the config directive `RequestHeader set Accept-Encoding "gzip,foobar"' 
# is overriden by client's Accept-Encoding request header.
#
# Side effect: not yet cached response data goes out uncompressed.
#

LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so

RequestHeader set Accept-Encoding "gzip,foobar"
Header echo Accept-Encoding

FilterDeclare my_filter1 CONTENT_SET
FilterProvider my_filter1 INFLATE req=Accept-Encoding $foobar
FilterProvider my_filter1 INFLATE req=Accept-Encoding !$gzip
FilterChain my_filter1

CacheRoot c:/apache2/cache
CacheMinFileSize 0
CacheMaxFileSize 256000
CacheEnable disk /
CacheDirLevels 2
CacheDirLength 2

ProxyPreserveHost On
ProxyPass / http://xxx.xxx.xxx.xxx/
ProxyPassReverse / http://xxx.xxx.xxx.xxx/
</httpd.conf>

I also needed to patch mod_cache.c to initialize output filters and properly 
handle redirects from backend. Here's the patch:
http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=13433

Regards
Przemek Czerkas

Reply via email to