Does vanity pages gets cached? | Community
Skip to main content
JeevanRaj
New Participant
Jul 12, 2022 5:37 AM UTC
Solved

Does vanity pages gets cached?

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.
Mohit_KBansal
Mohit_KBansalAccepted solution
Employee
Jul 12, 2022 6:00 AM UTC

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

5 replies

arunpatidar
New Participant
Jul 12, 2022 7:52 AM UTC
JeevanRaj
JeevanRajAuthor
New Participant
Jul 12, 2022 11:01 AM UTC

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.

Translate
Mohit_KBansal
Mohit_KBansalAccepted solution
Employee
Jul 12, 2022 6:00 AM UTC

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

Translate
JeevanRaj
JeevanRajAuthor
New Participant
Jul 12, 2022 11:00 AM UTC

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?

Translate
Mohit_KBansal
Employee
Jul 12, 2022 11:22 AM UTC

@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

 

Translate