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

cahce the source variable on the URL

msina
Level 4
Level 4

Hi

We have requirement to cache the source variable on the URL in dispatcher.

we want to cache the page which has parameter name source only.

e.g

https://localhost/test/2018/12/19/test1.amp.html?source=android

https://localhost/test/2018/12/19/test1.amp.html?source=ios

Currently its caching only the .html file in dispatcher cache.

Dispatcher version : dispatcher-apache2.4-4.2.3

Thanks

Sina

1 Accepted Solution
antoniom5495929
Correct answer by
Level 7
Level 7

Hi,

is not possible to cache a request with a querystring. It's for this reason that, even if you are configuring the ignoreUrlParameter, in your cache directory you are not able to find the request.

Calls which contains a query string are considered like "dynamic". If you need to cache the result of a request with a variable parameter i can suggest you to use selectors instead of query string. By using the selectors the dispatcher is able to cache the result even if you are using different selectors.

cq5 - Selectors in AEM - Stack Overflow

The above link is not the official documentation (i'm sure that some other guy of the staff could share with you the official documentation) but explain what is a selector and how use it.

If you cannot use the selector, i think that the only way that you have to cache you request by using a query string is to use a CDN.

Let us know.

Thanks,
Antonio

View solution in original post

5 Replies
Gaurav-Behl
Community Advisor
Community Advisor

Do you mean that you want to cache the page that has "source" in querystring?

If yes, then update /ignoreUrlParams section in dispatcher.any

/ignoreUrlParams

{

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

  /0002 { /glob "source" /type "allow" }   # this means that the pages with querystring as source, would be allowed to cache in dispatcher and other querystring requests would still go to publish as denied in the above rule.

}

msina
Level 4
Level 4

Added 0003 and restarted dispatcher but still i see only the .html cached in dispatcher.Is there should be any other file inside the cache folder?

/ignoreUrlParams

        {

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

        /0002 { /glob "cache_timestamp" /type "allow" }

        /0003 { /glob "source" /type "allow" }

      #  /0002 { /glob "q" /type "allow" }

        }

Actually we want to cahce/catch the source variable on the URL

regards

Sina

Andrew_Khoury
Employee
Employee

Please provide more details on what you are trying to cache.  /ignoreUrlParams would just ignore the source parameter and cache the file (minus the querystring).

Are you trying to cache varying versions of the same page / html by querystring param source?

antoniom5495929
Correct answer by
Level 7
Level 7

Hi,

is not possible to cache a request with a querystring. It's for this reason that, even if you are configuring the ignoreUrlParameter, in your cache directory you are not able to find the request.

Calls which contains a query string are considered like "dynamic". If you need to cache the result of a request with a variable parameter i can suggest you to use selectors instead of query string. By using the selectors the dispatcher is able to cache the result even if you are using different selectors.

cq5 - Selectors in AEM - Stack Overflow

The above link is not the official documentation (i'm sure that some other guy of the staff could share with you the official documentation) but explain what is a selector and how use it.

If you cannot use the selector, i think that the only way that you have to cache you request by using a query string is to use a CDN.

Let us know.

Thanks,
Antonio

View solution in original post

msina
Level 4
Level 4

Hi,

We have used selector to cache the page.Its working fine.

Thanks

Sina