LUNA Upgrade Browser Cache Settings

After an upgrade of LUNA sometimes the LUNA Viewer will look strange or not display as expected. This happens when we make substantial changes to the HTML and CSS. Some of these files are stored in your browser cache. By default we cache files for 7 days. So if a user accesses LUNA within 7 days before and after an upgrade they may see this problem and would need to clear their browser cache to fix the problem. We will describe how you can change this cache to 5 min instead of 7 days.


The change is pretty simple on the backend of LUNA.

In the web.xml located here:

~/LunaImaging/7.x/LUNA/tomcat/luna_apps/luna.war/WEB-INF

Find this section


<filter>
  <filter-name>cachefilter</filter-name>
  <filter-class>com.luna.CacheFilter</filter-class>
  <init-param>
   <param-name>max-age</param-name>
   <param-value>604800</param-value>
       <!-- time in seconds -->
  </init-param>
 </filter>

Comment out the param-value section that has 604800 which equals 7 days and make a new param-value with 300 which is 5 min.

<filter>
  <filter-name>cachefilter</filter-name>
  <filter-class>com.luna.CacheFilter</filter-class>
  <init-param>
   <param-name>max-age</param-name>
 <!--  <param-value>604800</param-value> -->
   <param-value>300</param-value>
       <!-- time in seconds -->
  </init-param>
 </filter>

After you have done this, restart LUNA's tomcat.

When 7 days have passed, after the upgrade, you can change this value back and restart tomcat.

We cache files to speed up load times of LUNA so it's good to have it set to 7 days normally.