A cache key decides which requests share one cached response. Query parameters can identify different content, so ignore them only when the application truly returns the same public resource.
IN THIS ARTICLE
What you need before you begin
List the parameters used for search, pagination, language, currency, authorisation and asset versioning. Confirm which controls your Cloudflare plan exposes before designing a custom key.
01 Control query-string caching without mixing different content
- Choose a narrow public path for the proposed Cache Rule and inspect responses for several parameter values.
- Keep parameters that change content or access rights in the key, or bypass caching for those requests.
- Use available query-string key settings only for parameters proven irrelevant, such as a specific tracking parameter on an otherwise identical public asset.
- Test different parameter combinations and compare both content and cache status from separate sessions. Include duplicate or reordered parameters if the application treats their order specially.
- Document the key design and purge affected objects appropriately when changing it. Review any purge tooling that assumes a simple URL-only key.
02 Example: classify query parameters before changing a cache key
Before ignoring query strings, compare actual responses for the same public path. These fictional examples demonstrate why parameters that change content need different treatment from a verified tracking-only value. They are review notes, not settings to paste into a rule.
/shop/?currency=NGN versus /shop/?currency=USD
Different prices or presentation: retain the variant or bypass.
/search/?q=backup versus /search/?q=email
Different results: do not merge into one cached response.
/assets/site.8a41c2ef.css?utm_source=newsletter
Consider ignoring only after proving the public file is identical.
Also identify signed-download tokens and version parameters. Removing a token from a key can break access separation, while ignoring a version parameter can preserve stale assets. Custom cache-key options depend on the available Cloudflare plan and rule controls.
Expected result: Only proven equivalent public requests share an entry. Different languages, currencies, search results and private downloads retain the separation needed for correct content and access.
Confirm the expected result
Different content variants should remain separate, while safe equivalent public requests may share a cache entry. Verify privacy and functional correctness before measuring the hit-rate improvement.
Troubleshoot unexpected results
Ignoring a signed download token, search query or language parameter can return the wrong content or expose protected data. Query-string sorting is also unsafe for applications where order has meaning. Custom-key options vary by plan.
Can I ignore a cache-busting version parameter?
Only if you replace that update mechanism. Otherwise old and new asset versions may share the same edge entry, defeating the reason the application added the parameter.