Highlighted

DispatcherMaxAgeHeaderFilter.

Avatar

Avatar

vegardengen

Avatar

vegardengen

vegardengen

11-10-2019

I am trying to add cache-control headers on publish, following this guide:

Dispatcher TTL

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

Replies

Highlighted

Avatar

Avatar

jbrar

Employee

Avatar

jbrar

Employee

jbrar
Employee

11-10-2019

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

Highlighted

Avatar

Avatar

vegardengen

Avatar

vegardengen

vegardengen

11-10-2019

[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:

/farms {

        $include "enabled_farms/*_farm.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:

cat /opt/aem/publish/crx-quickstart/launchpad/config/com/adobe/acs/commons/http/headers/impl/DispatcherMaxAgeHeaderFilter%007ebarn-articleImages.config

:org.apache.felix.configadmin.revision:=L"2"

filter.pattern=[ \

  "/content/dam/barn-dnb-no/page-images/article-pages/(.*)", \

  ]

max.age="7200"

service.factoryPid="com.adobe.acs.commons.http.headers.impl.DispatcherMaxAgeHeaderFilter"

service.pid="com.adobe.acs.commons.http.headers.impl.DispatcherMaxAgeHeaderFilter~barn-articleImages"

Highlighted

Avatar

Avatar

Bharath_valse

Avatar

Bharath_valse

Bharath_valse

11-10-2019

Please check if the path in question(/content/dam/barn-dnb-no/page-images/article-pages/illustration_barne hagefradrag.svg) is cached on the dispatcher. if not try to cache the files for TTL to work.

Highlighted

Avatar

Avatar

vegardengen

Avatar

vegardengen

vegardengen

11-10-2019

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.

Highlighted

Avatar

Avatar

Bharath_valse

Avatar

Bharath_valse

Bharath_valse

11-10-2019

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.

Highlighted

Avatar

Avatar

vegardengen

Avatar

vegardengen

vegardengen

14-10-2019

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?