I would like to be able to cache pages that have a query. E.g, those with a querystring such as www.domain.com?q=search
We're fronting our installation with Akamai, and Akamai is already caching these URLs, but each 15mins Akamai will go back to the origin and fetch straight from the publisher again. Because there is no cached file for this URL. I'd like to change this.
One way I saw suggested to do this is:
1) Rewrite in apache to www.domain.com.q.search.html (or similar)
2) Then rewrite again in AEM to www.domain.com?q=search - I suspect using etc/map??
Can anyone suggest the rewrite rules I need in 1) and the mechanism I need in 2)
Thanks!
Solved! Go to Solution.
You did it right, the ignoreURLParameters setting ignores the query string and caches the page as if the query string wasn't in the URL. Normally the ignoreURLParameters is used to impact query parameters that don't impact the HTML to be returned, but rather impact the display client side or are used for analytic purposes. Examples might be an email campaign ID, or sorting parameter that is implemented client side. See http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring URL Parameters. If you want to cache all the variations of a based on they query string you will have to rewrite them to selectors or something similar.
Rewriting the query string to a selector in Apache is the right way to make the requests cachable.
Changing it back to query string with /etc/maps is bad idea in my opinion - your code that the renders the pages should look to pull the information out of the selector instead of the query string.
Here are some examples of rewriting the query string https://wiki.apache.org/httpd/RewriteQueryString
Views
Replies
Total Likes
Why don;t just ignore the url param in dispatcher by following
http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring%20URL%20Parameters
Views
Replies
Total Likes
Sham, I initially wanted to use the /ignoreURLParameters setting, but the effect of using this is that query parameters are in fact ignored. So www.blog.com/page?tag=square is equal to www.blog.com/page?tag=triangle. They are saved in the apache layer as www.blog.com/page.html
Please correct me if that should work though, maybe I did something wrong on my end.
Views
Replies
Total Likes
You did it right, the ignoreURLParameters setting ignores the query string and caches the page as if the query string wasn't in the URL. Normally the ignoreURLParameters is used to impact query parameters that don't impact the HTML to be returned, but rather impact the display client side or are used for analytic purposes. Examples might be an email campaign ID, or sorting parameter that is implemented client side. See http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring URL Parameters. If you want to cache all the variations of a based on they query string you will have to rewrite them to selectors or something similar.