Expand my Community achievements bar.

SOLVED

cahce the source variable on the URL

Avatar

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

Avatar

Correct answer by
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

Avatar

Level 10

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.

}

Avatar

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

Avatar

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?

Avatar

Correct answer by
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

Avatar

Level 4

Hi,

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

Thanks

Sina