cahce the source variable on the URL

msina

28-01-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

antoniom5495929

29-01-2019

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

Answers (4)

Answers (4)

Gaurav-Behl

MVP

28-01-2019

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.

}

Andrew_Khoury

Employee

28-01-2019

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?

msina

28-01-2019

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