AVIF Accept Header Impact on CDN Cache Hit Ratios

Delivering AVIF images via HTTP content negotiation significantly reduces image file sizes and improves page load times, but it directly affects content delivery network (CDN) cache hit ratios. By relying on the Accept request header to determine whether a browser supports AVIF, edge servers must store multiple format variants for a single image URL. Without proper header normalization or edge logic, this header variation fragments the cache, diluting cache density and reducing overall cache hit ratios.

The Role of the Vary: Accept Header

When an origin server serves AVIF dynamically based on browser capability, it evaluates the incoming Accept header and returns a Vary: Accept response header. This header instructs intermediate caches, including CDNs, that the cached response depends on the exact Accept header sent by the client.

If a browser advertises support for image/avif, the CDN attempts to serve an AVIF copy. If another client lacks this support (such as older mobile browsers), the CDN must serve WebP or traditional JPEG/PNG formats. Consequently, a single asset URL no longer maps to a single cached file, inherently dividing the potential cache hit pool among multiple format variants.

The Problem: Cache Key Fragmentation

The primary reason the AVIF Accept header harms CDN performance is string diversity. Different browsers and client libraries format the Accept header differently. For example:

By default, an unmanaged CDN treats each distinct header string as a distinct cache key. Even if ten clients all support AVIF, subtle variations in spacing, MIME type ordering, or quality (q) values cause cache misses. This creates dozens of separate cache entries for the exact same AVIF file, driving the cache hit ratio down dramatically.

Impact on Cache Hit Ratios

  1. Cold-Start Penalties: Every unique browser format request triggers a cache miss and an origin request to fetch or generate the image.
  2. Lower Cache Retention: CDN edge nodes operate on finite storage. Splitting one asset into two or three image formats (AVIF, WebP, JPEG) triples the storage footprint for that asset. On high-volume or long-tail catalogs, this leads to aggressive cache evictions, further suppressing hit ratios.
  3. Regional Edge Differences: In geographies where modern browser adoption lags, regional CDN nodes experience unbalanced variant requests, leading to inconsistent performance profiles across different user locations.

Strategies to Protect Cache Hit Ratios

To benefit from AVIF without degrading CDN cache efficiency, implementations should apply specific edge-routing patterns: