Reference guide · images · Published 2026-08-16 · 4 min read

Image CDN configuration

Configure an image CDN: URL transform parameters, caching with immutable URLs, variant presets and the purge flow for updates.

What an image CDN does

An image CDN (also called a cut-image service) is a content delivery network that adds image transformation and delivery, normally in front of your origin image store (your server, S3, R2). Instead of serving a fixed file, the edge resizes, crops, converts to WebP/AVIF and strips metadata on the fly, computes a cache key from the requested transform, and serves repeat requests from the edge cache.

This is the difference that matters for the image optimisation workflow: the source set of originals is small, and every variant a page needs is derived on demand from the same original, so you stop maintaining 12 manually-cropped copies per photo.

The transform URL

Image CDNs use a URL pattern to declare the transformation:

https://img.example.com/{preset}/{path}
https://img.example.com/cdn-cgi/image/width=800,format=auto/{path}

Each provider has its own parameter grammar (?width=, &format=webp, &quality=, &fit=, &crop=) and a preset/variant system. The two useful patterns for a website:

  1. A one-url-per-size service that quietly converts format (format=auto picks WebP/AVIF for browsers that support them).
  2. A variant preset (thumbnail, hero, og) defined once in the CDN panel, so the template only ever emits hero.webp.

Use the ones that map to how your srcset sizes are authored: a width parameter that matches the w descriptors in your srcset means the browser's pick algorithm keeps choosing the right size.

Caching and the immutable rule

Transform variants are cached responses, and the cache rules for images follow the http caching guide exactly:

The cache-busting rule for images is therefore the same as for CSS/JS: never reuse a URL that means two different files over time if you need the cache to be correct.

The purge workflow

When an original changes and you regenerated with the same URL:

  1. Purge the specific variant URLs (one per width/format used).
  2. Or bump the content-hash in the path and redeploy (image-optimisation-guide shows the versioned-filename pattern).
  3. Verify the edge shows the new render, not the stale cached one (request from a different region or with a cache-busting query).

Most CDNs expose purge-by-URL and purge-by-prefix, and a Webhook/API to automate it (the purge cloudflare cache article shows the Cloudflare shape, which generalizes to other vendors).

When an image CDN is and is not the answer

Config checklist

The CDN static assets guide has the general CDN caching behavior, and the web image formats guide explains the format choices the config expresses.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services