Expand my Community achievements bar.

Dispatcher not adding cache-control to requests with query parameters

Avatar

Level 2

We are experiencing some unusual behaviour regarding Dispatcher. If we make a request to a page that should not be cached according to out dispatcher rules, and the request contains query parameters, then the response is missing the Cache-Control header.

We would expect to see 

cache-control: max-age=0, no-cache, no-store, must-revalidate

but we do not see the cache control header at all.

This is occurring regardless of whether the query parameter is in the list of ignored query params or not. If we remove the query params then we see the normal cache-control header as expected.

Topics

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

3 Replies

Avatar

Level 5

cache-control header is not set in AEM by default, So you will have to check at the custom rule/code which sets this header, maybe the regex to match the url expects a query parameter.

 

How are you setting the cache-control header ?

Avatar

Level 2

I did not realise the cache control: max-age=0 was not a Dispatcher out of the box feature, sorry.

 

In our Apache web server, we are adding the "cache-control: max-age=0, no-cache, no-store, must-revalidate" to all responses that do not contain the Etag header, as this means the page is not cached. This works as expected if the request does not contain a query string, but if the request does contain a query string then we do not see the cache-control header, even though Etag is missing. It is as if something is removing the cache-control header for requests with query strings. We have Cache-Control in our /headers config.