Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Make query string to be cached in dispatcher

Manh_Nguyen
Level 3
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
Feike_Visser1
Correct answer by
Employee
Employee

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

View solution in original post

8 Replies
kautuk_sahni
Employee
Employee

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.

Manh_Nguyen
Level 3
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

Manh_Nguyen
Level 3
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.

Feike_Visser1
Correct answer by
Employee
Employee

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

Manh_Nguyen
Level 3
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

MaxBarrass
Level 3
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.

Jörg_Hoh
Employee
Employee

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