Hello All,
We have a Sling Model which returns true/false based upon, whether the request has a particular cookie or not in it.
The dispatcher caches the first request to the page(which may or may not a have cookie on it). The next time a person requests the page, they will get the first person's response from cache. .
But we want to cache two copies of the page, one for people with the cookie in request , one for without cookie in request
Is it possible to cache like this? or any alternative approach to achieve above scenario?
Thanks in Advance
Sreenivasula Reddy
Views
Replies
Total Likes
I have never read anywhere that Dispatcher caches 2 versions of the same page.
Views
Replies
Total Likes
Thanks Scott!
Is there any alternative approach to handle such situation, where Sling model evaluates to a different value(true/false) based on request (if it has a cookie true, if not false)? And we need to cache, such 2 page variants?
Views
Replies
Total Likes
The dispatcher can only return what is requested. It has no built-in logic to decide if a page has to be returned or a different page.
You can of course 2 versions of that page with different selectors
Then you have 2 pages, but you still need to know upfront, which one you need to display, as you need to create the correct link to it.
Jörg
Views
Replies
Total Likes
Thanks Jorg!
We have above requirement as part of personalizing the content in AEM 6.0 using client context. Certain segment of users have a cookie in their request, so we have to show personalized content (along with default content for all users) and certain does not have this cookie in their request, so we wont show any personalized content(only default content).
But we want to cache the page for both scenarios( personalized and default). So in the above scenario, how to implement caching ?
thanks in advance
Views
Replies
Total Likes
Render all the content into the very same HTML and hide the personalized part by default? In case the cookie is present make this content visible?
Of course I could imagine more complex scenarios, but this would be a very simple solution.
Jörg
Views
Replies
Total Likes
So you mean you need single personalized page to be served for all the authenticated users?
Views
Replies
Total Likes
Thanks Navin!
Yes its a single page(home page with some default content authored on the page and a teaser component added for personalized content).
Only authenticated users have access to this home page.
When some segment of users (say sales) access the page, they have a cookie in their request,so we have to show both default and personalized content
For rest of the users, who does not have a cookie in their request, we have to show only default content.
So my question is how caching works in the above 2 scenarios ?
Views
Replies
Total Likes
So far i know it cannot be done using simple AEM Dispatcher configuration. You can do a trick using Apache Rewrite module.
1. Keep 2 pages (PageWithCookie & pagewithNoCookie) in AEM, which will be cached in Dispatcher.
2. Evaluate a condition inside that if cookie header is there in request then serve the PageWithCookie else serve pagewithNoCookie.
Hope this would work.
Views
Replies
Total Likes
navinkaushal that approach is working, but it does not scale when you need to implement similar logic to other pages as well. Do you want authors to raise a IT ticket to change the dispatcher/webserver config?
Jörg
Views
Replies
Total Likes
Offcourse this cannot be done without help of IT. IT guys can keep a pattern so that this config dont need to get changed again and again.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies