Caching
Transformed images are cached in Cloudflare R2 so subsequent identical requests skip the origin fetch and image processing entirely.
Cache key
The cache key is built from the output format, URL path, and query string:
{format}{pathname}{search}
// Example:
avif/photos/hero.jpg?w=800&quality=80 Cache behavior
- MISS — image is fetched from origin, transformed, stored in R2, and served
- HIT — image is served directly from R2, no origin fetch or processing
Observability
Every response includes an X-Cache header:
X-Cache: HIT // served from R2
X-Cache: MISS // fetched and processed from origin Cache duration
Cached responses include Cache-Control: public, max-age=86400 (24 hours).