Does vanity pages gets cached? | Community
Skip to main content
JeevanRaj
Community Advisor
Community Advisor
July 12, 2022
Solved

Does vanity pages gets cached?

  • July 12, 2022
  • 2 replies
  • 1435 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mohit_KBansal

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-configuration.html?lang=en

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

2 replies

Mohit_KBansal
Adobe Employee
Mohit_KBansalAdobe EmployeeAccepted solution
Adobe Employee
July 12, 2022

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-configuration.html?lang=en

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

JeevanRaj
Community Advisor
JeevanRajCommunity AdvisorAuthor
Community Advisor
July 12, 2022

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?

Mohit_KBansal
Adobe Employee
Adobe Employee
July 12, 2022

@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-configuration.html?lang=en#enabling-access-to-vanity-urls-vanity-urls

 

arunpatidar
Community Advisor
Community Advisor
July 12, 2022
JeevanRaj
Community Advisor
JeevanRajCommunity AdvisorAuthor
Community Advisor
July 12, 2022

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.