How to turn on mod_cache with mod_proxy or mod_jk


I'm trying to setup apache+mod_jk/mod_proxy with mod_cache.

But it looks like all proxied requests are ignored by mod_cache.
May be it is related to module handling order or something else?
Apache 2.2.22

I've tried use both mod_jk and mod_proxy – nothing helps.
LogLevel set to debug.

VirtualHost (https):

    ProxyPass /app/ https://server:8443/app/
    ProxyPassReverse /app/ https://server:8433/app/

    CacheEnable mem /

    #tried JkMount / loadbalancer
    #tried Also disk
    #CacheDefaultExpire 3600
    #CacheEnable disk /
    #CacheDirLevels 2
    #CacheDirLength 1
    #CacheMaxFileSize 3000000
    #CacheMinFileSize 1
    #CacheIgnoreCacheControl On
    #CacheIgnoreNoLastMod On
    #CacheIgnoreQueryString On
    #CacheIgnoreHeaders Set-Cookie
    #CacheLastModifiedFactor 0.1
    #CacheMaxExpire 86400
    #CacheStoreNoStore On
    #CacheStorePrivate On

If I request some non-proxied resource (server/test.png) I successfully see in logs or in disk store that resource has been cached.

It's very odd for me because I saw in documentation and in Google that peoples successfully use mod_cache with proxy.

Best Answer

Looks like it actually works, but only for mem_cache. Disk Cache ignores proxied content.

Also If request has no-cache or max-age 0 content wouldn't be cached and immediately re-requested from backend.

Related Topic