Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Dispatcher TTL for requests with query parameters

Avatar

Level 2

I am using the ACS Commons Dispatcher TTL feature to set max-age headers to certain requests. I've also configured a list of query parameters which are ignored by Dispatcher. Both of these are working as expected. However, if a request is made to a page that contains ignored query parameters, then the page becomes cached in Dispatcher, but with no max-age header. This appears to be expected behaviour for the ACS Commons Dispatcher TTL feature, so what is the best way to ensure that requests that contain ignored query parameters can still be cached in Dispatcher with a max-age header?

 

EDIT: This unwanted behaviour only occurs if a request is made to a page that has not yet been cached in Dispatcher (or the cache has expired), and the request contains query parameters on the list of ignored query params, so that Dispatcher still creates the cache file, but no max-age header is added by the ACS Commons code.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Community Advisor

Have you enabled the TTL? Does is your response headers for caching setup?

Take a look at these configurations in the dispatcher.any file.

Example of enabled cache-control cached header, and enabled TTL on the dispatcher.any file:

 

# Cache response headers next to a cached file. On the first request to
# an uncached resource, all headers matching one of the values found here
# are stored in a separate file, next to the cache file. On subsequent
# requests to the cached resource, the stored headers are added to the
# response.
#
# Note, that file globbing characters are not allowed here.
#
/headers
{
   "Cache-Control"
   "Content-Type"
   "Last-Modified"
}
# Enable TTL evaluates the response headers from the backend, and if they
# contain a Cache-Control max-age or Expires date, an auxiliary, empty file
# next to the cache file is created, with modification time equal to the
# expiry date. When the cache file is requested past the modification time
# it is automatically re-requested from the backend.
#
/enableTTL "1"

 

 

 

Avatar

Level 2
Hi, to clarify, dispatcher is working correctly, caching pages that are required to be cached. Also, the ACS Commons Dispatcher TTL also works correctly, however it only adds the header to requests that do not contain any query params. However, for requests that contain an ignored query param, ACS Commons does not add the max-age header, but dispatcher still caches it. I am looking for the best way to have the page cached with a max-age header, since ACS Commons will not add it.

Avatar

Level 1

Hi, I am also facing the same issue. Did you find any solution for this ?