Expand my Community achievements bar.

Testing Cache control headers

Avatar

Level 2

How to test the cache control headers from the browser?

eg 

<LocationMatch "^/content/.*\.(html)$">
     Header set Cache-Control "max-age=200"
     Header set Age 0
</LocationMatch>

 

How to test this cache control header from browser network?

5 Replies

Avatar

Community Advisor

You just simply step on the .html resource (page.html) and check the Headers section, which will show the "cache-control" header and the value should match your configuration.

Esteban666_0-1687811124111.png


The "Age" header is primarily used by intermediary caches to determine the freshness of cached content and to make decisions about serving cached responses. It is not typically exposed or visible in the browser's network tab, as it is more relevant to the functioning of proxy servers and other intermediary caching systems.

 



Esteban Bustamante

Thanks for the response @EstebanBustamante . This is the configuration i have in my host file - 

Silvia_Joyce_Balraj_0-1687812349423.png

However the response i see in the browser is this - 

Silvia_Joyce_Balraj_1-1687812397238.png

I am not sure why I'm seeing no-cache in the cache control.

Avatar

Community Advisor

Check the following:

1. Do you have any configuration under you /clientheaders that may be conflicting? (https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...)

2. Try to restart the Apache server after your changes

3. Make sure your page is not served from the cache (CDN, Dispatcher or browser)

 



Esteban Bustamante

Avatar

Community Advisor

Hi @Silvia_Joyce_Balraj  Both of these commands(first and second line) are used to control caching behavior. The first command sets a maximum age for the response, allowing it to be cached for a certain period. The second command resets the age to 0, indicating that the response should be considered fresh and not served from cache.

 

hope this helps.

 

-Thanks

Bilal

Avatar

Community Advisor

Hello @Silvia_Joyce_Balraj 

 

After making changes to cache-control headers, always assure that the existing cached page on dispatcher is flushed.

If the pages are served from CDN as well, then first debug by accessing pages via dispatcher URL. If that looks good, either flush the CDN cache or wait for it to clear.

 

Also, did you configure this?

Define DISABLE_DEFAULT_CACHING

 

 


Aanchal Sikka