Expand my Community achievements bar.

SOLVED

Query parameter is getting cached only in publisher/dispatcher

Avatar

Level 4

Hi All,

 

I have the below URL with the query parameter.I'm triggering a servlet and the servlet will pick the query parameter value and it will give the response based on query param value.

 

EX: https://wwwqa.powerlb.product.com/content/product/au/en_au/iron-product.html?q=Iron_tablets

 

It is working fine in AEM author instance and issue with only in the dispatcher. If, I hit the same URL with different params, I'm getting the caching/incorrect response in the dispatcher. 

 

EX: https://wwwqa.powerlb.product.com/content/product/au/en_au/iron-product.html?q=Calcium_tablets

 

if I hit the above URL in the dispatcher, I'm the response for the first param (q=Iron_tablets). Can you help here to fix the issue.

 

@arunpatidar26 @smacdonald2008 @arunpatidar26 @Ratna_Kumar @kautuk_sahni @wimsymons @cqsapientu69896 @vanegi @Veena_Vikram @varuns7990 @Theo_Pendle

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @vijays80591732 

 

Seems like query parameter caching is enabled in dispatcher. Check /ignoreUrlParams section of dispacher.any file if it has any rules defined like:

 

/ignoreUrlParams
{
    /0001 { /glob "*" /type "deny" }
    /0002 { /glob "q" /type "allow" }
}

 

This rule makes the query param request cachable and basically ignores query param "q" for further request and returns the same cached response.

 

Refer https://docs.adobe.com/content/help/en/experience-manager-dispatcher/using/configuring/dispatcher-co... and read more on ignoreUrlParams section. 

 

Hope it helps!

Thanks!

Nupur

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @vijays80591732 

 

Seems like query parameter caching is enabled in dispatcher. Check /ignoreUrlParams section of dispacher.any file if it has any rules defined like:

 

/ignoreUrlParams
{
    /0001 { /glob "*" /type "deny" }
    /0002 { /glob "q" /type "allow" }
}

 

This rule makes the query param request cachable and basically ignores query param "q" for further request and returns the same cached response.

 

Refer https://docs.adobe.com/content/help/en/experience-manager-dispatcher/using/configuring/dispatcher-co... and read more on ignoreUrlParams section. 

 

Hope it helps!

Thanks!

Nupur

Avatar

Employee

Hi @vijays80591732,

Ideally it's not possible to cache the requests that contain query string. Such calls are considered dynamic therefore it should not be expected to cache them.

 

Here in your case, it looks like the query params [q] is getting cached, I think the config /ignoreUrlParams is what you are looking for. It can be used to white list the query parameters which are used to determine whether a page is cached / delivered from cache or not.
 
 
And then add the following rule:
 
/ignoreUrlParams
{
    /0001 { /glob "*" /type "deny" }
}

Please make sure that the following rule /0002 { /glob "q" /type "allow" } is not set under /ignoreUrlParams. If so, remove the rule and restart the Apache web-server after making these modification.

 

Thanks,

Vaishali

Avatar

Community Advisor

Hi @vijays80591732 ,

 

By default, dynamic requests are not cached which is a request with query parameter.  

 

In your case, dynamic requests are caching nothing but you have a rule in a dispatcher config to cache the request with query parameter.

Please do have a check for the below rule and make you have not enabled the caching for query param.

 

/ignoreUrlParams
{
    /0001 { /glob "*" /type "deny" }
}

 

The above rule will disable the caching a request which has a query parameter.

Make sure you have not enabled caching by adding  /0002 { /glob "*" /type "allow" } to ignoreUrlParams.

 

For more details please check the document below.

https://docs.adobe.com/content/help/en/experience-manager-dispatcher/using/configuring/dispatcher-co...