Re: Problem caching with Apache 2.2 mod_proxy
"Hermann Husen" <[email protected]>
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], "Dr. Frank Hoffmann" <fh@...> wrote: > > FYI: The code snippet refers to a former Apacher version: > http://httpd.apache.org/docs/1.3/mod/mod_proxy.html > PS: > If you have got the mod_proxy directive successfully tested for Apache 2.2 > please send it to the forum; I will extend the "howto" document. > Our configuration (apache 2.2.3): /etc/apache2/mods-enabled/proxy.conf: <IfModule mod_proxy.c> ProxyRequests Off <Proxy *> AddDefaultCharset off Order deny,allow Deny from all ProxyFtpDirCharset UTF-8 </Proxy> ProxyVia On </IfModule> /etc/apache2/mods-enabled/disk_cache.conf: <IfModule mod_disk_cache.c> CacheRoot /var/cache/apache2/mod_disk_cache CacheDirLevels 5 CacheDirLength 3 </IfModule> /etc/apache2/sites-enabled/httpd-mySite.conf: <Proxy *> Order allow,deny Allow from all </Proxy> <VirtualHost *> ServerName www.hermann-husen.de RewriteEngine On RewriteRule ... CacheEnable disk / CacheRoot /path-to-MySite/proxycache CacheDirLevels 2 CacheDirLength 1 CacheIgnoreNoLastMod On CacheDefaultExpire 3600 </VirtualHost> cache_config (DTML-Method): <dtml-if "REQUEST.get('preview','')=='preview' or (getObjProperty('attr_cacheable', REQUEST)==0)" ><dtml-call "RESPONSE.setHeader('Expires', '-1')" ><dtml-call "RESPONSE.setHeader('Cache-Control', 'no-cache')" ><dtml-call "RESPONSE.setHeader('Pragma', 'no-cache')" ><dtml-else><dtml-call "RESPONSE.setHeader('Expires', _.DateTime(_.DateTime().timeTime() + 86400).toZone('GMT').rfc822())" ><dtml-call "RESPONSE.setHeader('Last-Modified', bobobase_modification_time().toZone('GMT').rfc822())" ><dtml-call "RESPONSE.setHeader('If-Modified-Since', bobobase_modification_time().toZone('GMT').rfc822())" ><dtml-call "RESPONSE.setHeader('Cache-Control', 'proxy-revalidate')" ></dtml-if> Hint: Be sure, that RESPONSE.setHeader is working (you may want to explicitly check via wget -S http://yoursite.xx I had some problems to get the Headers working. HTML output must not have been occured (even white space ...) prior to RESPONSE.setHeader. Otherwise RESPONSE.setHeader is beeing ignored (my experience). Kind regards, Hermann Husen