You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ed...@verizon.com on 2006/05/09 03:35:50 UTC

[users@httpd] mod_cache behavior with proxied images - urls not cached

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 302 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 302 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