Ignore the Query String in Your CDN Cache Key

TUTORIAL

Make the CDN cache by path only, so /style.css?v=1 and /style.css?v=2 share one cached copy: where the Ignore query setting lives, how to enable it, and when to leave it off.

The CDN identifies a cached object by its full URL, query string included, so /style.css?v=1 and /style.css?v=2 are two separate objects, each fetched from the origin once. Ignore query switches a resource to caching by path only: every query variant of a URL shares one cached copy. This tutorial enables it and explains which content it suits.

Prerequisites

Step 1: Open the Connection Settings

Open the resource’s settings (the gear icon on its row) and click Advanced settings. In the Connection group of the General page, find Ignore query, directly under Origin Shield. It is off on a new resource:

Ignore query row in the Connection area with its toggle reading Disabled

Step 2: Enable It and Save

Click the toggle to switch it on:

Ignore query toggle staged on, reading Enabled

Click Save at the bottom of the page. Nothing changes until you do. From the next request on, the CDN strips the query string before looking up the cache and before it fetches from the origin, so the first variant requested fills the cache for all of them.

When to Use It

Query strings Setting
Never change the response: tracking parameters such as utm_source, campaign or session tags, cache-busting values some clients append On. Each variant otherwise costs its own origin fetch and cache slot for identical content; ignoring the query raises the hit ratio and cuts origin traffic.
Change the response: search results, paginated lists, filtered API responses, image resizing parameters Off. With the setting on, the first variant fetched would be served for all of them.

The setting applies to the whole resource, every location included. Give content that needs the opposite behaviour its own resource.

What You Have

A resource where URL variants of the same file no longer dilute the cache: one origin fetch per path, a higher hit ratio, and less origin traffic for exactly the same content. To see the effect, compare the cache hit ratio in Monitor CDN Traffic and Cache Performance before and after the change.

Can’t find what you need? Our engineers are available around the clock, from quick fixes to full infrastructure design.