Set up targeted cache eviction with multiple Dispatcher farms in AEM

Configuring multiple Dispatcher farms in AEM can cause cache flush requests to route incorrectly when using localhost URLs. This article explains how to set up a second Dispatcher flush agent with host-based URLs to ensure GraphQL cache eviction targets the correct domain and docroot.

Description description

Environment

  • Product: Adobe Experience Manager (AEM) On-Premise
  • Version: 6.5
  • Apache version: 2.2 (local testing)
  • Configuration: Multiple farms and virtual hosts on the same Apache instance; separate docroots per domain

Issue/Symptoms

  • Cache flush requests intended for specific domains are incorrectly routed to the same farm, causing all invalidations to affect only one docroot regardless of the requested path or domain.
  • This occurs when using localhost URLs in flush agents, resulting in all requests being handled by the last-loaded farm due to Host header evaluation.

Resolution resolution

To resolve this issue, follow these steps:

  1. Ensure each Dispatcher farm is configured with distinct virtual host patterns that tightly match its intended domain(s).
  2. Set up your Apache virtual hosts so each ServerName or ServerAlias corresponds uniquely to each domain.
  3. For local environments, add entries in your hosts file mapping each domain to the appropriate IP address.
  4. Configure your AEM flush agents to use host-based URLs rather than localhost URLs.
  5. If publish and Dispatcher servers are on different machines, ensure DNS or hosts file resolution from the publish server points those hostnames to the Dispatcher server’s IP address.
  6. Confirm that Apache listens on the correct port (for example, port 80) without conflicts.
  7. Verify that cache invalidation requests sent via flush agents reach their respective farms and docroots by observing correct routing behavior.

Notes:

  • Dispatcher evaluates farms based strictly on the HTTP Host header, not URL path segments.
  • Using localhost in flush agent URLs causes all requests’ Host headers to be set as localhost, resulting in fallback routing to the last-loaded farm.
  • The described configuration works whether publish and Dispatcher run on the same or separate servers, provided hostname resolution is correctly set up.
  • No additional changes are required if Apache is already listening on port 80 with proper host mappings.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f