Expand my Community achievements bar.

SOLVED

How to allow url in dispatcher filter rules with multiple query parameters

Avatar

Level 1

How to allow url in dispatcher filter rules with multiple query parameters. I only know one parameter (example "test").

My url is something like this, www.test.com/abc/def/ghi.html?param1=123&test=456&param3=....

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sushmaa61672298 ,

 

You can use the ignoreUrlParams config in dispatcher.

The ignoreUrlParams  defines which URL parameters are ignored when determining whether a page is cached or delivered from cache:

  • When a request URL contains parameters that are all ignored, the page is cached.
  • When a request URL contains one or more parameters that are not ignored, the page is not cached.

For more details please refer to

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...

View solution in original post

2 Replies

Avatar

Employee

Please refer below URLs for caching requests with query param :
- https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-dispatcher-caches-page...
>> This can only return a single cached page
- https://one-inside.com/caching-pages-with-suffix-paths-in-aem-cq-dispatcher/
>> This appears to require significant customisation which also doesn't work OOTB.

To add to it, you can't really use query parameters if you want to cache distinct pages. "Ignore" tells Dispatcher to ignore the parameters which means it always returns the same cached result from the first call (with whatever parameters where there).
The "AEM" Style of parameters would be to encode the parameterized data into a suffix in the code that's calling the URL,
instead of foo.html?category=1234&product=9876 like so:
foo.html/category/1234/product/9876
or you encode the data somehow into selectors:
foo.cat_1234.prod_9876.html
If you don't have control over the requesting client, you can cache in the Publish with something like the EHCache framework (a bit slower than in Dispatcher)
Theoretically - though it can become very complicated - you should be able to write a regex that is doing the mapping from query parameter to selectors on the fly - though I would strongly discourage that, as this is not a clean design (and I haven't tried it myself)

One additional point to consider:
foo.html/category/1234/product/9876 the suffix would still require an extension in order for it to be cached, ie: foo.html/category/1234/product/9876.html or foo.json/category/1234/product/9876.json
Do not use ".html" as an extension when you have a suffix. (Or do not use any extension with and without suffix in the same project).

See "Conflicting Suffix URLs" in https://experienceleague.adobe.com/docs/experience-manager-learn/dispatcher-tutorial/chapter-1.html for details So the correct example would be something like
   foo.detail/category/1234/product/9876.html ^^^^^^

Avatar

Correct answer by
Community Advisor

Hi @sushmaa61672298 ,

 

You can use the ignoreUrlParams config in dispatcher.

The ignoreUrlParams  defines which URL parameters are ignored when determining whether a page is cached or delivered from cache:

  • When a request URL contains parameters that are all ignored, the page is cached.
  • When a request URL contains one or more parameters that are not ignored, the page is not cached.

For more details please refer to

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...