cachekey-query-args

This behavior includes or ignores URI query-string arguments either in total or by name when creating the Edge server cache entry (cache-key).

The setting that can be specified by the type parameter is as follows.

  • include-all – This is the default Edge server behavior, where all values in the query-string are included in the cachekey.
  • include – Only the space-separated name(s) of query arguments provided in the "value" attribute are included in the cache-key; all others are ignored. Supplying a parameter (key) with a value followed by a URL-encoded ampersand (e.g. - "key=value&") will only include the parameter in the cache-key if the key and value match the supplied definition
  • ignore-all – No query-string arguments are included in the cache-key.
  • ignore – Only the space-separated name(s) of query arguments provided in the "value" attribute are ignored in the cache-key; all others are included. Supplying a parameter (key) with a value followed by a URL-encoded ampersand (e.g. - "key=value&") will only ignore the parameter in the cache-key if the key and value match the supplied definition

A sample use case might be to ignore parameters that are traditionally cache-busting, such as unique session or user identifiers that do not modify the response in any way, For example, if the origin normally uses a "sessionid" query-string parameter to identify a user for tracking purposes but does not modify the response entity, then the parameter can be safely ignored (and definitely should be ignored if the object is cacheable). As another example, perhaps the origin publishes URLs with cache-busting parameters so browsers are forced to re-request certain objects when they are updated (E.g, adding "cache-bust={random_string"); if the goal is to bust the browser's cache but not the CDN cache, then the parameter should be ignored.

The following sample policy addresses both of the example cases for content in a hypothetical "/static/*" wildcard path match.


       "matches": [
         {
           "name": "url-wildcard",
           "value": "/static/*"
         }
       ],
       "behaviors": [
         {
           "name": "cachekey-query-args",
           "type": "ignore",
           "value": "sessionid cache-bust"
         }
       ]