One thing to be aware of when using multiple farms
configuration in the dispatcher is the anatomy of cache invalidation requests.
Cache invalidation requests are sent to the URL /dispatcher/invalidate.cache of the dispatcher. On
receiving this request dispatcher checks for the CQ-Handle http header field which
contains the path of the resource to be invalidated and performs the
invalidation based on the configuration on the dispatcher.
When dispatcher is configured
with multiple farms, it’s natural to expect that the invalidation request
matches the farm based on the resource that is invalidated. But this does not
happen.
Invalidation request tries to
match the farm based on URL of the invalidation request which is
/dispatcher/invalidate.cache
The configuration in the
matching farm identified for this URL is used for invalidation behavior. Since the
invalidation URL for all the resources in AEM is the same, all invalidation
requests irrespective of the resource being invalidated picks up the same
matching farm.
This poses a challenge in having different invalidation
configuration based on the resource being invalidated
URL Rewrite using CQ-Handle
One simple solution to handle this is to use URL rewrite on
Apache to pre-pend the value from the CQ-Handle header field to the
URL. This would prefix the URL with the path of the resource being flushed.
When this URL gets processed
by dispatcher, it would pick up the matching farm based on the path of the
resource being flushed and uses that farm configuration for invalidation
No comments:
Post a Comment