I am attempting to set up a reverse caching proxy for ad graphics (GIF, JPEG, 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 on a location on disk.
I am looking for a way to force all requests matching that prefix to be cached.
P.S. It looks like I’m having this exact issue: http://mail-archives.apache.org/mod_mbox/httpd-users/200901.mbox/%[email protected]%3E. I will be checking my permissions and go over debug messages…
Proxy caching is a feature of proxy servers that stores content on the proxy server itself, allowing web services to share those resources to more users. The proxy server coordinates with the source server to cache documents such as files, images and web pages.
Second, a caching proxy often functions as a second (or higher) level cache, getting only the misses left over from Web clients that use a per-client cache (e.g., Mosaic and Netscape). The misses passed to the proxy-server from the client usually do not contain a document requested twice by the same user.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With