Dispatcher enable ttl removes headers from response | Community
Skip to main content
Level 3
March 24, 2022
Solved

Dispatcher enable ttl removes headers from response

  • March 24, 2022
  • 2 replies
  • 1668 views

Hello,

 

I have a dispatcher configuration with 

/enableTTL "1"

 

Most of the caching is done based on stat files, but some resources needs to be cached using TTL. When I have a resource that is cached with ttl I noticed that it affects the response headers that are send to the browser,

 

for example I have an svg icon under my client library /etc.clientlibs/my-lib/resources/icon.svg when I have have TTL disabled I can se that Content-Type response header is present for this resource and browser correctly displays the icon. When I add the TTL "1" then the response header is gone.

 

I noticed that I can fix this by extending the /headres section in the /cache configuration

/cache
{

...
/enableTTL "1"

/rules
{
# Rules
}

/invalidate
{
# ...
}

/headers
{
# with this header content type is present in browser, without it it's lost for resources cached along with .ttl file
"Content-Type"
}
}

 

Is this a bug or am I missing something in the configuration? I can not see anything on that matter under https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en

 

I am using Dispatcher with AEM 6.5.9 and Windows IIS

 

Thanks,

Bartek

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

Agree, it should be added to the documentation, that the TTL-based caching is a superset of the header-caching, and therefor it requires this feature also being configured properly.

 

Can you log a ticket with support and request this to be added to the documentation?

2 replies

Fanindra_Surat
Community Advisor
Community Advisor
March 24, 2022

Hi @bartek_887 -

 

Could it be possible that the following events might have occurred in sequence:
1. First time you enabled TTL, it cached the file with empty headers, as your /headers section is empty and then the subsequent requests also received the same cached header file. See the below from the documentation:

 

The /headers property allows you to define the HTTP header types that are going to be cached by the Dispatcher. On the first request to an uncached resource, all headers matching one of the configured values (see the configuration sample below) 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.

 

2. Added the Content-Type in the /headers section which might have refreshed the cached headers file with the Content-Type header value and then the subsequent requests receiving the header.

3. Disabled the TTL, the header file cached in step2 is being returned.

 

 

 

Level 3
March 25, 2022

Hi,

 

I tested this on empty cache. So

1. I cleared cache

2. Enabled TTL

3. Requested resource (SVG)

4. It get cached without any headers (no .h file next to cached file)

5. Response was missing content type header

 

Then:

1. I cleared cache

2. Disabled TTL

3. Requested resource (SVG)

4. It get cached without any headers (no .h file next to cached file)

5. Response was not missing content type header

 

To make it work with ttl enabled I had to add headers section to the dispatcher config, then:

1. I cleared cache

2. Enabled TTL

3. Requested resource (SVG)

4. It get cached with headers (.h file next to cached file was created)

5. Response was not missing content type header

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
March 29, 2022

Agree, it should be added to the documentation, that the TTL-based caching is a superset of the header-caching, and therefor it requires this feature also being configured properly.

 

Can you log a ticket with support and request this to be added to the documentation?

Level 3
March 30, 2022

Hello,

 

I created a github ticket for dispatcher documentation page. Thanks 🙂 
https://github.com/AdobeDocs/experience-manager-dispatcher.en/issues/48