Expand my Community achievements bar.

SOLVED

Dispatcher enable ttl removes headers from response

Avatar

Level 3

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-c...

 

I am using Dispatcher with AEM 6.5.9 and Windows IIS

 

Thanks,

Bartek

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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?

View solution in original post

4 Replies

Avatar

Community Advisor

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.

 

 

 

Avatar

Level 3

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

Avatar

Correct answer by
Employee Advisor

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?