Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Make query string to be cached in dispatcher

Avatar

Level 3

Hi,

I'm trying to make the query string to be cached in dispatcher in separated files. Have read an article about Configuring Dispatcher, I tried

/ignoreUrlParams { /0003 { /glob "*" /type "allow" } }

but it keeps caching one files instead of multiple files as I'm trying to used many queries. For example:

I tried: mywebsite.com/homepage.html?x=1 and mywebsite.com/homepage.html?y=2, but the cache only have homepage.html

Is there any way to make multiple caches by different queries?

Any help would be appreciated.

My apache version is 4.2.2.

Many thanks,

Manh

1 Accepted Solution

Avatar

Correct answer by
Employee

I would more do something like homepage.y.3.html

View solution in original post

8 Replies

Avatar

Administrator

The ignoreUrlParams 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.

If you want to cache all the variations based on the query string you will have to rewrite them to selectors or something similar.



Kautuk Sahni

Avatar

Level 3

Hi kautuksahni,

Thanks for your reply.

From what you suggest, you mean that I need to rewrite the url to be something like:

"mywebsite.com/homepage.html?y=2" to "mywebsite.com/homepage/y/2"

Is that correct? If so, is there any guide/document on how to do it? I'm new on configure dispatcher, so any help would be appreciated.

Thanks,

Manh

Avatar

Level 3

Thanks for your reply.

From your webinars, I learned that dispatcher only cached the urls with extension (.html). So I tried

mywebsite.com/homepage.html/x/3 ---> will not be cached

mywebsite.com/homepage.html/x/3.html ---> will be cached [1]

But I have a problem, if [1] is cached, when I try to access mywebsite.com/homepage.html, it returns 404. Is it because of homepage.html is a directory, not file anymore? and is there anyway to resolved it? Appreciated for your help.

Thanks.

Avatar

Correct answer by
Employee

I would more do something like homepage.y.3.html

Avatar

Level 3

Thanks Feike.

Currently I'm doing the query string for filter, and it call the REST API service for getting the data. Is your way applied for REST API services? And Is there any document/guide on how to apply the queries for REST services?

Thanks in advanced,

Manh

Avatar

Level 3

So the answer looks like it's not possible.

Dispatcher caches assets and html files. Caching query string could create a DDOS scenario.

Avatar

Employee Advisor

Actually caching a query string is forbidden by the HTTP RFCs.