views:

772

answers:

1

I am attempting to set up a reverse caching proxy for ad graphics (gif, jpg, swf) serving. The proxying is working fine and sending the request on to the origin server, but I can't seem to figure out why the content isn't being cached. My current config is below. The goal is to cache all requests that match the /ca/ URI prefix. The origin server is serving the files with clean URLs, no file extensions, Cache-control max-age=1 week set on the origin server headers.

ProxyRequests Off
<Proxy *>
 Order deny,allow
 Allow from all
</Proxy>
<IfModule mod_disk_cache.c>
 CacheEnable disk /
 CacheRoot "/var/cache/mod_proxy"
 CacheDirLevels 3
 CacheDirLength 5
 CacheIgnoreCacheControl On 
</IfModule>

RewriteCond %{REQUEST_URI} ^/ca/*
RewriteRule ^/(.*)$ http://origin.webserver.com/$1 [P,L]

Currently, the only caching I've seen actually happen is that of local files accessed on the proxy servers, I'm looking for what I'm missing to get content fetched from the origin server to be cached.

I'm wondering if it has to do with mod_cache not caching because the content is fetched from the origin server, and not a location on disk. Looking for a way to force all requests matching that prefix to be cached.

Thanks!

p.s. - looks like I'm having this exact issue: http://mail-archives.apache.org/mod_mbox/httpd-users/200901.mbox/%[email protected]%3E. Will be checking my permissions and go over debug msgs...

+2  A: 

Adding these directives seemed to kick the cache mechanism into gear. I figure it has to do with expiration and cache-control headers as sent from the origin server since I'm serving up images with Symfony/PHP5 instead of directly from the filesystem.

<IfModule mod_disk_cache.c>
    CacheEnable disk /
    CacheRoot "/var/cache/mod_proxy"
    CacheDirLevels 3
    CacheDirLength 5
    CacheIgnoreCacheControl On
    CacheMaxFileSize 100000000
    CacheIgnoreNoLastMod On
    CacheMaxExpire 1209600
    CacheIgnoreQueryString On
</IfModule>
notbrain