Tomcat Cache Control

Ryan Carrie shared this idea 6 years ago
Completed

Can we implement a filter to disable browser caching?

Replies (2)

photo
1

This Idea has been logged for review by our development team. Subscribe or check back here for further information as it is available.

photo
2

This can be accomplished using a Tomcat filter. Simply edit your <YellowfinInstall>/appserver/webapps/ROOT/WEB-INF/web.xml file and add the following filter block to your file.

<filter>
    <filter-name>ExpiresFilter</filter-name>
    <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
    <init-param>
        <param-name>ExpiresByType image</param-name>
        <param-value>access plus 10 days</param-value>
    </init-param>
    <init-param>
        <param-name>ExpiresByType text/css</param-name>
        <param-value>access plus 10 hours</param-value>
    </init-param>
    <init-param>
        <param-name>ExpiresByType application/javascript</param-name>
        <param-value>access plus 10 minutes</param-value>
    </init-param>
    <!-- Let everything else expire immediately -->
    <init-param>
        <param-name>ExpiresDefault</param-name>
        <param-value>access plus 0 seconds</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>ExpiresFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>
Save and restart Yellowfin to disable browser caching for the application.

Leave a Comment
 
Attach a file