How to flush URL mapped resources from dispatcher
CQ5 provides URL mapping functionality through Apache Sling. One of the most important requirement is to be able to allow for SEO optimized URLs.
In conjunction with Dispatcher caching, there is a mismatch between previously cached html-resources and the Dispatcher flush request. In addition to that, if
statfileslevel is configured to a value > 0, the location of the
.stat files used to determine cache-validity do not match actually cached files.
- cached by Dispatcher at
/content/geometrixx/en/companyis replicated from authoring instance
- Dispatcher flush agent is requesting
/content/geometrixx/en/companyto be flushed from Dispatcher cache
- Dispatcher module tries to flush resources at
<docroot>/content/geometrixx/en/company.*and doesn't find anything -> cache not flushed
The actual issue is that the Dispatcher flush request sends the absolute path of a resource to be flushed from the Dispatcher cache as a result of a replication. In order to resolve this mismatch, it is recommended to rewrite mapped URLs back to their original absolute path form on webserver level which causes the Dispatcher module to read, write and flush cache-entries consistently on filesystem level. This also applies for reading and writing
If Apache HTTP Server is used as webserver,
mod_rewrite provides all necessary functionality to achieve the rewriting.
Following is an example how to configure rewriting with Apache's
mod_rewrite module. The example is based on:
- map incoming requests to the domain
RewriteRule ^/(.*\.html)$ /content/geometrixx/de/$1 [PT]