Open http://aem-host:port/miscadmin for each AEM publish instance
When I have multiple virtual hosts with separate AEM Dispatcher cache farms configured in my web server, then how do I flush the correct cache from AEM?
Environment
Apache HTTP Server / AEM dispatcher
Steps
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 httpd VirtualHost configurations:
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.geometrixx.com ServerAlias *.geometrixx.com DocumentRoot /var/www/html/cache-www-geometrixx-com ... </VirtualHost> <VirtualHost *:80> ServerName www.geometrixx-outdoors.com ServerAlias *.geometrixx-outdoors.com DocumentRoot <Global Doc root>/site2 Include <Configurations specific to site2> </VirtualHost> DocumentRoot /var/www/html/cache-www-geometrixx-outdoors-com
In the dispatcher configuration, you have multiple farms configured to handle different sites by host name (virtualhosts):
/virtualhosts { "*geometrixx.com*" } /renders { ... } /cache { /docroot "/var/www/html/cache-www-geometrixx-com"
Set up multiple flush agents
If you only have a handful of separate dispatcher farms (5 or less), then configuring multiple flush agents is an easy solution.
-
-
Browse to Replication => Agents on Publish
-
Click Edit
-
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 host name of the site. For example: "flush-agent-www-geometrixx-com"
-
Select the "Extended" tab
-
Under HTTP Headers add another header. As the value enter "Host: www.geometrixx.com" where "www.geometrixx.com" should be replaced by one of the sites' DNS hosts.
-
Click Ok to save
-
Go to http://aem-host:port/useradmin and create the user from step 4
-
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
-
Save
-
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.
-
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
ln -s /var/www/html/cache-www-geometrixx-com/libs /var/www/html/shared-cache
-
Now when you activate pages under a specific site, the flush request would only get directed to the applicable flush agent