Expand my Community achievements bar.

SOLVED

How dispatcher caches page with query params in url

Avatar

Level 4

I know there is a way to cache pages in dispatcher even with query params in URL thru ignoreUrlParams section in dispatcher.any file.

My question is: Let's say I have two URLs www.abc.com/en/product.html?q=1 and www.abc.com/en/product.html?q=2. I know it's not recommended to cache pages in dispatcher where output is dependent on query param. But if I do it, how this page will be stored in dispatcher cache?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee

As you mentioned in your question, currently dispatcher has capability to cache one copy of product.html which will be same for q=1 and q=2. Please refer to https://docs.adobe.com/docs/en/dispatcher/disp-config.html ad look for ignoreUrlParams . 

If you want to cache different copies for q=1 and q=2, then only way is to write a rewrite rule that converts this url to selector based or suffix based url. For ex., www.abc.com/en/product.html?q=1 to www.abc.com/en/product.html/q.1.html  or www.abc.com/en/product.1.html 

View solution in original post

4 Replies

Avatar

Level 10

As you said, technically its not recommended and havent tried it. However, all the pages are cached to the location specified in the /docroot attribute of the /cache section in the dispatcher.any file

Avatar

Community Advisor

It's cached as a single page. e.g. one copy.

It's also important to remember that when q=1 and 1=2 produce different results. The page that got invoked first will produce the output that will be later presented regardless of parameter supplied.

Peter

Avatar

Correct answer by
Employee

As you mentioned in your question, currently dispatcher has capability to cache one copy of product.html which will be same for q=1 and q=2. Please refer to https://docs.adobe.com/docs/en/dispatcher/disp-config.html ad look for ignoreUrlParams . 

If you want to cache different copies for q=1 and q=2, then only way is to write a rewrite rule that converts this url to selector based or suffix based url. For ex., www.abc.com/en/product.html?q=1 to www.abc.com/en/product.html/q.1.html  or www.abc.com/en/product.1.html 

Avatar

Level 8

PuzanovsP wrote...

It's cached as a single page. e.g. one copy.

It's also important to remember that when q=1 and 1=2 produce different results. The page that got invoked first will produce the output that will be later presented regardless of parameter supplied.

Peter

 

I added this to the docs... thanks. 

http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring%20URL%20Parameters

scott