How to flush the dispatcher cache when there are farms with separate cache folders

Learn how to flush the dispatcher cache when there are farms with separate cache folders. Set Host header and configure Agent User ID.

Description description


Experience Cloud Services


How to flush the dispatcher cache when there are farms with separate cache folders.

Resolution resolution

To set up one dispatcher flush agent per dispatcher farm, set the Host header and configure the Agent user ID  with a user that has read access to relevant paths.

In the solutions below, we assume the following:

  • You are using Apache HTTP Server 2.2 or later version
  • Multiple VirtualHosts configured
  • Multiple dispatcher farms with separate caches

For example:

Apache https VirtualHost configurations:

NameVirtualHost *:80
<VirtualHost *:80>
 ServerAlias *
 DocumentRoot /var/www/html/cache-www-geometrixx-com
<VirtualHost *:80>
 ServerAlias *
 DocumentRoot <Global Doc root>/site2
 Include <Configurations specific to site2>
DocumentRoot /var/www/html/cache-www-geometrixx-outdoors-com

In the dispatcher configuration, you have multiple farms configured to handle different sites by hostname (virtualhosts):

 /cache {
 /docroot "/var/www/html/cache-www-geometrixx-com"

Set up multiple Flush Agents

If you only have a handful of separate dispatcher farms (five or less), then configuring multiple flush agents is an easy solution.

ln -s /var/www/html/cache-www-geometrixx-com/libs /var/www/html/shared-cache
  1. Open http://aem-host:port/miscadmin for each AEM publish instance.

  2. Browse to Replication >  Agents on Publish.

  3. Click Edit.

  4. Under the Agent User ID, enter the name for a user which you create later that would be associated with this agent. You could use a naming convention with the hostname of the site. For example: “flush-agent-www-geometrixx-com”.

  5. Select the Extended  tab .

  6. Under HTTP Headers, add another header. For value, enter “Host:” where “” should be replaced by one of the sites’ DNS hosts.

  7. Click  Ok  to save.

  8. Go to  http://aem-host:port/useradmin  and create the user from step 4.

  9. On the Permissions tab of the user, grant the user read access to any paths that you would like the agent to be allowed to flush for the referenced site. For example: /content/geometrixx, /content/dam, /etc, /libs, /apps, /var.

  10. Click Save.

  11. Repeat steps 1 - 10 for all other sites on each publish instance. You will be creating one flush agent for each site on each publish instance.

  12. On the web server, share common paths using symlinks. For example, you could set symlinks for /content/dam, /etc., /libs, /apps, and /var to a common cache location. Then /content and anything under the root of the cache would be separately cached. Here’s an example command for the /libs folder

    code language-none
    ln -s /var/www/html/cache-www-geometrixx-com/libs /var/www/html/shared-cache
  13. Now, when you activate pages under a specific site, the flush request is only directed to the applicable flush agent.