Tomcat Cache – How to Disable Tomcat Caching for Static Files

cachetomcatweb-server

How do I prevent tomcat from caching? I have css and basic html files that I load and use via ajax, and unless I restart tomcat, the changes do not seem to reflect. Different machines, different browsers, and I don't receive the updated files.

Thoughts?

Best Answer

You might have to delete the application cache folder in /work/Catalina/localhost after changing the cachingAllowed flag.

Configuration can be introduced in server.xml as

<Context className="org.apache.catalina.core.StandardContext"
                 cachingAllowed="false"
                 charsetMapperClass="org.apache.catalina.util.CharsetMapper"
                 cookies="true" 
                 reloadable="false" 
                 wrapperClass="org.apache.catalina.core.StandardWrapper">
        </Context>