Dispatcher TTL
Available since version 2.2.0
Requires AEM Dispatcher v4.1.11+
Purpose
Easily set TTL headers on Requests in support of AEM Dispatcher 4.1.11 TTL support.
ACS AEM Commons Dispatcher TTL allows Response Headers to be set instructing AEM Dispatcher to respect a TTL-based timeout. This feature does expect that a Dispatcher is in the request chain. To enable support in other scenarios, see the note.
The following expiration configurations are supported
- Max-Age
- Daily
- Weekly
- Monthly
How to Use
Configure AEM Dispatcher
First ensure sure AEM Dispatcher 4.1.11 or greater is installed. Then in dispatcher.any
set /enableTTL "1"
.
Create OSGi Configurations
Create the a series of sling:OsgiConfig
’s each representing a Path and TTL-scheme.
In your AEM Content project, create a sling:Folder
under your application’s /apps
folder.
Max Age
/apps/mysite/config/com.adobe.acs.commons.http.headers.impl.DispatcherMaxAgeHeaderFilter-paths-set-1.xml
max.age
: Max age value (in seconds) to put in Cache Control header.
Daily
/apps/mysite/config/com.adobe.acs.commons.http.headers.impl.DailyExpiresHeaderFilter-paths-set-2.xml
max.age
: Max age value (in seconds) to put in Cache Control header.expires.time
: Time of day which the content expires (HH:mm)
Weekly
/apps/mysite/config/com.adobe.acs.commons.http.headers.impl.WeeklyExpiresHeaderFilter-paths-set-3.xml
max.age
: Max age value (in seconds) to put in Cache Control header.expires.time
: Time of day which the content expires (HH:mm)expires.day-of-week
: Day of week to expire the content. Allowed values:Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
,Sunday
.
Monthly
/apps/mysite/config/com.adobe.acs.commons.http.headers.impl.MonthlyExpiresHeaderFilter-paths-set-4.xml
max.age
: Max age value (in seconds) to put in Cache Control header.expires.time
: Time of day which the content expires (HH:mm)expires.day-of-month
: Day of month to expire the content. Will expire on the closes day. Ex. If set to 31, in February will expire on the 28th (or 29th on leap-year).
Note
This feature expects that the Dispatcher was involved in the request chain. This expectation is managed via a known HTTP Header. To simulate the Dispatcher, add the necessary HTTP header to the request:
Server-Agent: Communique-Dispatcher
An example cURL request to add this header:
curl -v -H “Server-Agent: Communique-Dispatcher” http://localhost:4502/content/test -u admin:admin
The output of the above would be: