Correction, 304 (not 302)
[Mon May 08 20:36:32 2006] [debug] mod_cache.c(114): incoming request is asking for a uncached version of /portal/msa/images/ochregradient.gif, but we know better and are ignoring it
[Mon May 08 20:36:32 2006] [debug] mod_cache.c(446): cache: /portal/msa/images/ochregradient.gif not cached. Reason: HTTP Status 304 Not Modified
__________________
We are looking into caching images on Apache that are proxied from a backend server. However, it looks like a lot of traffic will still go to the backend.
We have Apache configured like this:
<IfModule mod_cache.c>
<IfModule mod_mem_cache.c>
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreHeaders Set-Cookie
CacheDefaultExpire 3600
CacheMaxExpire 86400
CacheEnable mem /backend/images
MCacheRemovalAlgorithm LRU
MCacheSize 32768
MCacheMaxObjectCount 1024
MCacheMinObjectSize 1
MCacheMaxObjectSize 1048576
</IfModule>
</IfModule>
If I remove all my local temporary files, then this seems to work well. The image is retrieved from the backend and cached on Apache. Then subsequent requests are handled by Apache.
But, we have a large base of existing clients who will most likely already have local copies of images. When such a client loads a page, the requests are passed through to the backend only to find that they have not been modified and a 304 is returned for each image. This causes a lot of unnecessary traffic to the backend. How can we avoid that?
When Apache starts up, the cache is empty. These images are not getting cached because the client issues a conditional GET. The file is not in the Apache cache, so the request is passed to the backed.
Then the backend responds with a 304 so Apache is not able to retrieve the image and put it in the cache. Do we have to initialize the cache somehow?
Thanks,
Ed