Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to set up Apache as a forward proxy with caching, but it does not seem to be working correctly. Getting Apache working as a forward proxy was no problem, but no matter what I do it is not caching anything, to disk or memory. I already checked to make sure nothing is conflicting in the mods_enabled directory with mod_cache (ended up commenting it all out) and also I tried moving all of the caching related fields to the configuration file for mod_cache. In addition I set up logging for caching requests, but nothing is being written to those logs. Below is my Apache config, any help would be greatly appreciated!!

<VIRTUALHOST *:8080>
ProxyRequests On
ProxyVia On
#ErrorLog "/var/log/apache2/proxy-error.log"
#CustomLog "/var/log/apache2/proxy-access.log" common
CustomLog "/var/log/apache2/cached-requests.log" common env=cache-hit
CustomLog "/var/log/apache2/uncached-requests.log" common env=cache-miss
CustomLog "/var/log/apache2/revalidated-requests.log" common env=cache-revalidate
CustomLog "/var/log/apache2/invalidated-requests.log" common env=cache-invalidate
LogFormat "%{cache-status}e ..."

        # This path must be the same as the one in /etc/default/apache2
        CacheRoot /var/cache/apache2/mod_disk_cache

        # This will also cache local documents. It usually makes more sense to
        # put this into the configuration for just one virtual host.

        CacheEnable disk /
        #CacheHeader on
        CacheDirLevels 3
        CacheDirLength 5
##<IfModule mod_mem_cache.c>
#        CacheEnable mem /
#        MCacheSize 4096
#        MCacheMaxObjectCount 100
#        MCacheMinObjectSize 1
#        MCacheMaxObjectSize 2048
#</IfModule>


<Proxy *>
Order deny,allow
Deny from all
Allow from x.x.x.x
#IP above hidden for this post

<filesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "proxy-revalidate"
</filesMatch>

</Proxy>
</VIRTUALHOST>
share|improve this question
What version of Apache are you using? I am attempting the same with latest Apache 2.4.3 and it doesn't work for me either. Similar config - proxy and cache within same vhost. This may be due to a bug – IanS Nov 27 '12 at 4:33

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.