Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

AEM cloud Dispatcher Invalidate Multiple Domains issue

Avatar

Level 3

Hi ,

I am trying to setup multiple domains on the AEM cloud and i have done all the vhosts and farm configuration. I am able to render both sites with different docroot . However i am having trouble invalidating dispatcher cache when replicating the page from author to publish and the dispatcher cache invalidation. when i try to publish the the XML,  the cache invalidation needs to be done for "wwwfarm" however i am always seeing localhost being selected and its going to the last farm "stagefarm' and invalidating in the wrong path. I did not find anything related this adobe documentation. If we have multiple sites with different docroot on the same AEM cloud instances how do we invalidate the dispatcher cache on the right cache directory. Any inputs are appreciated?

 

 

 

 farms[wwwfarm].cache.docroot = /mnt/var/www/html/www ----> www.site1.com
 farms[stagefarm].cache.docroot = /mnt/var/www/html/stage ---> www.site2.com

 

No farm matches host 'localhost', selected last farm 'stagefarm', referer: about:blank
 Found farm stagefarm for localhost, referer: about:blank
checking [/dispatcher/invalidate.cache], referer: about:blank
Activation detected: action=Activate [/content/dam/www/xml-sitemaps/es-sitemap.xml], referer: about:blank
Touched /mnt/var/www/html/stage/.stat, referer: about:blank
Touched /mnt/var/www/html/stage/content/.stat, referer: about:blank
Touched /mnt/var/www/html/stage/content/dam/.stat, referer: about:blank
 response.status = 200, referer: about:blank
response.headers[Server] = "Communique/2.6.3 (build 5221)", referer: about:blank
cache flushed,

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

if you are doing that way then you need to have a separate Configuration of Dispatcher farm for invalidating the content.

see Configure Dispatcher to Handle Multiple Domains section on https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-d...

"Configure a Dispatcher farm that is used for invalidating content the cache, regardless of which domain the content belongs to. This farm handles file invalidation requests from Flush Dispatcher replication agents."

 

View solution in original post

14 Replies

Avatar

Community Advisor
NOTE

For proper Dispatcher invalidation, make sure that requests from “127.0.0.1”, “localhost”, “.local”, “.adobeaemcloud.com”, and “.adobeaemcloud.net” are all matched and handled by a vhost configuration so the request can be served. You can do this task by global matching “*” in a catch-all vhost configuration following the pattern in the reference AEM archetype. Or, you can ensure that the previously mentioned list is caught by one of the vhosts.

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/conten...

 

Avatar

Level 3

i did have those defined, but when the page is published the cache invalidation does not seem to going to the right folder. Does both Vhosts needs to have the localhost defined? How does the cache 

 

<VirtualHost *:80>
	ServerName	site1.com
	# Put names of which domains are used for your published site/content here
		#  ServerAlias  "*"
    	   ServerAlias  "localhost"
    	   ServerAlias  "*.local"
    	   ServerAlias  "www.site1.com"
    	   ServerAlias  "*.adobeaemcloud.com"
    	   ServerAlias  "*.adobeaemcloud.net"
    	   ServerAlias  "publish*.adobeaemcloud.net"
           ServerAlias  "publish*.adobeaemcloud.com"
           ServerAlias  "preview*.adobeaemcloud.com"

	DocumentRoot "${DOCROOT}/www"
           
           
           
           <VirtualHost *:80>
	ServerName	site2.com
	# Put names of which domains are used for your published site/content here
		#  ServerAlias  "*"
    	   ServerAlias  "localhost"
    	   ServerAlias  "*.local"
    	   ServerAlias  "www.site2.com"
    	   ServerAlias  "*.adobeaemcloud.com"
    	   ServerAlias  "*.adobeaemcloud.net"
    	   ServerAlias  "publish*.adobeaemcloud.net"
           ServerAlias  "publish*.adobeaemcloud.com"
           ServerAlias  "preview*.adobeaemcloud.com"
	DocumentRoot "${DOCROOT}/stage"

 

Avatar

Community Advisor

Yes, both vhost should have those configuration. Is it still selecting the wrong farm for you?

Avatar

Level 3

Correct, wrong farm is being selected when i am publishing page or assets to invalidate the dispatcher cache. 

Avatar

Community Advisor

Can you try with updating those values in virtualhosts section of your farm configuration as well and check if that helps.

Avatar

Level 3

i have added the values localhost”, “.local”, “.adobeaemcloud.com”, and “.adobeaemcloud.net in the virtual host section of both farm but it did not work the farm selection does not seem to work when invalidating the cache between different content sites. I found this link but i am not sure how this can be done for cloud since we would be using SCD and not setting up agent as such.

 

https://helpx.adobe.com/experience-manager/kb/How-to-flush-the-dispatcher-when-there-are-farms-with-...

Avatar

Community Advisor

Tt seems the configs are right. the problem is you are creating 2 different farms prod and stage with similar configuration on vhost and is always going to last farm. Normally you shouldn't use separate farms for stage and prod and it should behaves same for all environment. Different farm is only required when you have different  configuration for multiple sites for same environment.

Avatar

Level 3

Thats just my naming convention, i does not directly correlate to the AEM stage and PROD on cloud. I do have multiple sites in the same environment.  

Avatar

Community Advisor

separate docroot is not required for dispatcher configuration for multiple site. you can work with same docroot folder for all sites configuration per environment

Avatar

Level 3

Is that how its done for the cloud ? per adobe documentation it said we need to setup a docroot for each site and dispacther from the documentation below

 

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-d...

Avatar

Correct answer by
Community Advisor

if you are doing that way then you need to have a separate Configuration of Dispatcher farm for invalidating the content.

see Configure Dispatcher to Handle Multiple Domains section on https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-d...

"Configure a Dispatcher farm that is used for invalidating content the cache, regardless of which domain the content belongs to. This farm handles file invalidation requests from Flush Dispatcher replication agents."

 

Avatar

Community Advisor

@ragucis  I also faced this issue. The issue is because the default host is picked up by default on priority list. So to change the order of the loading vhost or farm files add 111_******** to the enable_vhosts files or enable_farm files. refer to below screenshot. If you are still unable to understand the issue DM . I can explain it 

Jagadeesh_Prakash_0-1691388784816.png

 

Avatar

Level 3

hi @Jagadeesh_Prakash  I have already done this and my enable_vhosts files or enable_farm files are loading in the correct order and i have then numbered like 001_wwfarm and 002_stagefarm . The invalidation seem to be going to right path when coming the domain name is attached and TTL expires , only issue is invalidation when publishing pages from author to publish on cloud.

Avatar

Community Advisor

@ragucis  what is the cache rules that you have set. Can you check if yoru headers are accepted ? 

make sure s-maxage is not 0

Jagadeesh_Prakash_0-1691479411479.png