You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by longbao xiao <xi...@gmail.com> on 2015/04/02 10:46:18 UTC

[users@httpd] Apache 2.4 mod_cache does not use the cache

Hello,


Please help me!

I'm trying to caching of dynamic pages on apache 2.4.10 mod_cache.
When accessing from the one terminal on the same page,
cached response is returned in the second and subsequent access.

But, When accessed from different terminals, even though not passed the
Expires,
cached response is not returned, the origin server respond.
And When there is not If-Modified-Since in request header, cached response
is returned.
I didn't know why this happens.

As a result of checking the Apache source,
If there is a If-Modified-Since in request header,
Last Modified of server-side cache is newer than If-Modified-Since in
request header
(this happens, after a client accessed, the other client access),
without determining whether or not the server-side cache past the Expires),
Apache does not use the cache.
As mentioned above, I recognized.

Is my recognition is right?
Also, if my perception is wrong,
please tell me how to return the cache.

As a result of checking at the header of the cache file,
Vary is only Accept-Encoding.
And I tried with the two terminals of the same Accept-Encoding.

setting of mod_cache I use below.
```
<IfModule mod_cache.c>
    <IfModule mod_cache_disk.c>
        CacheIgnoreCacheControl On
        CacheIgnoreNoLastMod On
        CacheStoreNoStore On
        CacheStorePrivate On
        CacheDefaultExpire 60
        CacheMaxExpire 60
        CacheIgnoreHeaders Set-Cookie Cookie
        CacheIgnoreURLSessionIdentifiers _
        CacheQuickHandler off
        CacheRoot /tmp/cache
        CacheEnable disk /aaaaa
        CacheDirLevels 2
        CacheDirLength 2
    </IfModule>
</IfModule>
```

Regards,
Xiao long Bao