Expand my Community achievements bar.

SOLVED

Does vanity pages gets cached?

Avatar

Community Advisor

Suppose say I have a page /content/example/xyz.html and I have configured a vanity URL i.e, /abc. My question is when a user hits /abc, will this be served from dispatcher cache or will it be served from publisher every time?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The answer depends on how you want to handle it, but if your question is if it's possible to cache vanity pages, where vanity is configured on AEM page property, the answer is yes, you can cache it on the dispatcher.

 

My approach would be:

  1. Add a rewrite rule on apache to prefix /content/page/context/path of your site on all requests without extn in it.
  2. suffix .html also in same request
  3. Dispatcher will cache your page /content/page/context/path/<vanity>.html

 

The downside will be with cache flush, as the dispatcher cache flush agent will flush the actual page path only and not vanity.  You can do vanity configuration on dispatcher [1].

 

I suggest you also check ACS commons Redirect Manager [2] to handle vanity.

 

If possible, i recommend to handle vanity via Apache rewrites (301 or PASS Through)

 

Thanks

Mohit

 

[1] https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...

[2] https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html

View solution in original post

5 Replies

Avatar

Correct answer by
Employee Advisor

The answer depends on how you want to handle it, but if your question is if it's possible to cache vanity pages, where vanity is configured on AEM page property, the answer is yes, you can cache it on the dispatcher.

 

My approach would be:

  1. Add a rewrite rule on apache to prefix /content/page/context/path of your site on all requests without extn in it.
  2. suffix .html also in same request
  3. Dispatcher will cache your page /content/page/context/path/<vanity>.html

 

The downside will be with cache flush, as the dispatcher cache flush agent will flush the actual page path only and not vanity.  You can do vanity configuration on dispatcher [1].

 

I suggest you also check ACS commons Redirect Manager [2] to handle vanity.

 

If possible, i recommend to handle vanity via Apache rewrites (301 or PASS Through)

 

Thanks

Mohit

 

[1] https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...

[2] https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html

Avatar

Community Advisor

Thanks Mohit for the response. i understood your approach on how to cache the page for vanity URLs. However, do you have any recommendation on how to flush this cache on invalidation?

Avatar

Employee Advisor

@JeevanRaj You can leverage vanity url configuration of dispatcher [1]

 

AEM provides a URI that returns list of vanity configured in AEM

 

/libs/granite/dispatcher/content/vanityUrls.html

 

Dispatchers use this URI to manage cache

/vanity_urls {
      /url "/libs/granite/dispatcher/content/vanityUrls.html"
      /file "/tmp/vanity_urls"
      /delay 300
 }

 

[1] https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...

 

Avatar

Community Advisor

Hi @arunpatidar ,

Thanks for sharing the article. But i was looking for how to cache the vanity pages. The current OOTB behaviour is such that the pages requested through vanity urls are always served from publisher.