Available since version 1.2.0
How to Use
Add a Sling rewriter configuration node (example below) that includes the
versioned-clientlibs transformer type to you project.
The URIs to clientlibs will be rewritten in the format
Prior to version 1.5, the last modified timestamp was used instead of a hash.
This re-writer does NOT support
- Relative URIs, e.g.
- URIs including a scheme, e.g.
- URIs to non-AEM HtmlClientLibrary resources, e.g.
- Tags contained in conditional comments.
Rewriter Configuration Node
The easiest way to configure the rewriter pipline is just to copy
/libs/cq/config/rewriter/default to a path inside your application, e.g.
/apps/myapp/config/rewriter/versioned-clientlibs. Note that the configuration node must be inside a four-level path that ends in
To validate that your configuration was successful, look at the Sling Rewriter tab in the OSGi Web Console.
Other transformers may or may not be necessary. Please refer to the default configuration at
/libs/cq/config/rewriter/defaultto see the default set of transformers.
To configure Apache to send the right header to set a long TTL:
MD5 Enforcement (Since 2.11.0/3.8.0)
Optionally, a filter can registered which checks incoming requests for client libraries and ensures that the hash in the path is the correct value. To enable this, set the property
true on the PID
If you enable this option, the hash will be prefixed with
ACSHASHto ensure that only rewritten paths are validated. Be sure to incorporate this into any web server or CDN rules.