Written by The Jahia Team
   Estimated reading time:
How to change the time in Jahia cache for images?


We recommend using a front-end server (apache, load-balancer) in order to modify this value in the HTTP header.

An alternative solution is to create the following path and to copy the below last-urlrewrite.xml file:
In this file, in the JCR files rule, you have to change the value of max-age=1 to the desired value.
In this case, the file overrides the one in the jahia-impl*.jar library.
In case (not really probable) that this file is modified in a future version of Jahia, you should have to repeat this operation in order to have an up to date version of the last-urlrewrite.xml file.


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"

    <!-- Client-side caching -->
        <name>Set no cache headers</name>
        <note>Resources that should not be cached</note>
        <condition type="attribute" name="jahiaCacheControlSet" operator="equal">^$</condition>
        <set type="response-header" name="Expires">Wed, 09 May 1979 05:30:00 GMT</set>
        <set type="response-header" name="Cache-Control">no-cache, no-store, must-revalidate, proxy-revalidate, max-age=0</set>
        <set type="response-header" name="Pragma">no-cache</set>
        <set type="request" name="jahiaCacheControlSet">done</set>
        <name>JCR files</name>
        <note>Do not set any cache expiration for JCR files</note>
        <condition type="attribute" name="jahiaCacheControlSet" operator="equal">^$</condition>
        <set type="response-header" name="Cache-Control">public, must-revalidate, max-age=1</set>
        <set type="request" name="jahiaCacheControlSet">done</set>
        <name>Set cache expires headers</name>
        <note>Cache all other resources by default</note>
        <condition type="header" name="Expires" operator="equal">^$</condition>
        <condition type="attribute" name="jahiaCacheControlSet" operator="equal">^$</condition>
        <set type="expires">1 month</set>
        <set type="response-header" name="Cache-Control">public, max-age=2678400</set>
        <set type="request" name="jahiaCacheControlSet">done</set>
    <!-- end of client-side caching -->
        <name>Append servername</name>
        <note>Check if we need to add server name</note>
        <condition type="attribute" name="jahiaSeoServernameForLink" operator="notequal">^$</condition>