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.


  • request
  • cached by Dispatcher at <docroot>/geometrixx/en/company.html
  • /content/geometrixx/en/company is replicated from authoring instance
  • Dispatcher flush agent is requesting /content/geometrixx/en/company to 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

Answer, Resolution

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 .stat files.

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 to /content/geometrixx/de
<VirtualHost *:80> 
    RewriteEngine On 
    RewriteRule ^/(.*\.html)$ /content/geometrixx/de/$1 [PT] 
    <Directory /> 
    <IfModule disp_apache2.c> 
        SetHandler dispatcher-handler 
    Options FollowSymLinks 
    AllowOverride None 


CQ5.2.x, CQ5.3


Get help faster and easier

New user?