Course contentsShow
← Cloud and Infrastructure
Lesson 607 of 2,98911. CDN and Edge ComputingFree lesson

Cache Key Normalization

Configure how URLs and parameters are normalized to maximize cache hit ratios.

Cache Key Normalization

What you'll learn: How CDNs use cache key normalization to treat similar requests as identical, boosting cache efficiency.

The Problem with URLs

When a CDN caches content, it creates a cache key from the incoming request—typically from the URL. But users might request the same content in slightly different ways:

  • https://example.com/image.jpg?width=800&height=600
  • https://example.com/image.jpg?height=600&width=800

These URLs are functionally identical, but without normalization, the CDN treats them as two separate cache entries—wasting storage and reducing your cache hit ratio.

What is Cache Key Normalization?

Cache key normalization is the process of standardizing how URLs, query strings, headers, and cookies are transformed into cache keys. By configuring normalization rules, you tell the CDN: "these variations should all point to the same cached object."

Common normalization strategies:

  • Query string sorting: Alphabetize parameters so ?a=1&b=2 and ?b=2&a=1 produce the same key
  • Case normalization: Treat /Image.JPG and /image.jpg as identical
  • Whitelist/blacklist parameters: Include only meaningful parameters (ignore tracking IDs like ?utm_source=)
  • Header normalization: Standardize Accept-Encoding or User-Agent values that don't affect content

The Analogy

Think of cache keys like filing cabinet labels. Without normalization, "Smith, John" and "John Smith" go in separate folders even though they're the same person. Normalization is your filing rule that ensures consistent labeling.

Configuration Impact

When you configure query string forwarding (lesson 598) or custom headers (599), you directly affect the cache key. Adding more variables to the key increases uniqueness—reducing cache hits. Smart normalization balances serving correct content while maximizing reuse.

Key Takeaway:
Cache key normalization standardizes URL variations into consistent keys, dramatically improving cache hit ratios by eliminating duplicate cached objects for functionally identical requests.