Testing Cache control headers | Community
Skip to main content
Level 2
June 26, 2023

Testing Cache control headers

  • June 26, 2023
  • 3 replies
  • 3100 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 26, 2023

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.




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
Level 2
June 26, 2023

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

However the response i see in the browser is this - 

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

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 26, 2023

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-configuration.html?lang=en)

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
bilal_ahmad
Level 5
June 27, 2023

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

aanchal-sikka
Community Advisor
Community Advisor
June 27, 2023

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