Understanding Query String Sort

Query String Sort allows customers to increase cache hits on resources with varied query strings.


Overview

Query String Sort is only available to Enterprise customers.

By default, Cloudflare’s cache treats resources as distinct if their URL query strings are in a different order.  For instance, these resources are cached separately:

  • /video/48088296?title=0&byline=0&portrait=0&color=51a516
  • /video/48088296?byline=0&color=51a516&portrait=0&title=0

Query String Sort increases cache-hit rates by first sorting query strings into a consistent order before checking the Cloudflare cache. If two query strings exist with the same name, the URL is sorted by the parameter value.  For example:

/example/file?word=alpha&word=beta and /example/file?word=beta&word=alpha

are sorted to:

/example/file?word=alpha&word=beta


Enable Query String Sort

Query String Sort is available in the Cloudflare dashboard under the Caching app.

  1. Log into your Cloudflare account.
  2. Choose the appropriate domain for which you want to enable Query String Sort.
  3. Click the Caching app.
  4. Scroll down to Enable Query String Sort

Toggle the switch to On.


Related resources

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk