I am trying to add cache-control headers on publish, following this guide:
I have added a few configuration, and can see that the filter triggers - but the header is not on the response from publish.
I have tried this directly to publish, remembering to add the Server-Agent header.
Debug logs for com.adobe.acs states that the header is added, but the response does not contain this header.
I am using AEM 6.5 and have ACS version 4.3.2
Can you check the following:
- Dispatcher version is >4.1.1
- /enableTTL "1" is set on dispatcher
- Allow this header in the dispatcher.any file
[Wed Oct 09 14:10:11 2019] [I] [pid 1282 (tid 139690814244992)] Dispatcher initialized (build 4.3.2/apache2.4-linux-x86_64)
We have several dispatcher farms, so this is my dispatcher.any:
The relevant dispatcher farm, however, have enableTTL 1.
I have debugged this directly towards my publish instance too, like this:
curl -k -v --header "Server-Agent: Communique-Dispatcher" http://localhost:4503/content/dam/barn-dnb-no/page-images/article-pages/illustration_barnehagefradra...
This is my response headers:
< Content-Disposition: attachment; filename="illustration_barnehagefradrag.svg"
< Last-Modified: Thu, 10 Oct 2019 12:14:37 GMT
< Content-Type: image/svg+xml
< Content-Length: 15904
This is the content of my acs.log from this request.
11.10.2019 16:02:22.419 *DEBUG* [qtp849642209-2206] com.adobe.acs.commons.http.headers.impl.AbstractDispatcherCacheHeaderFilter Adding header Cache-Control: max-age=7200
Which corresponds to what is set here:
It is getting cached in dispatcher, and I have also deleted the cache to see that this is not the problem.
Nevertheless, for this testing I am bypassing dispatcher, and as described above, I have verified that the relevant configured actions are triggered on publish.
I feel this is expected because the request is for an asset directly which returns binary. Try requesting for a path(/content/dam/barn-dnb-no/page-images/article-pages) which should return the expected response headers related to cache. Post this the actual test you should be doing is if the cache is cleared on the dispatcher with the set expire time.
It seems you are right?
So, hardcoding these in dispatcher config is the only option for static content, but for dynamic content, OSGI config is also an option, then?