Question

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.

Example:

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

Applies

CQ5.2.x, CQ5.3

Esta obra está autorizada con arreglo a la licencia de Reconocimiento-NoComercial-CompartirIgual 3.0 Unported de Creative Commons.  Los términos de Creative Commons no cubren las publicaciones en Twitter™ y Facebook.

Avisos legales   |   Política de privacidad en línea