no-transform: Preventing Proxy Modifications

Learn how the no-transform directive prevents intermediaries like mobile carriers and CDNs from modifying response bodies, including image compression and format conversion.

Advanced

Detailed Explanation

What Is no-transform?

The no-transform directive instructs intermediaries (proxies, CDNs, mobile carriers) not to modify the response body in any way. Without it, some intermediaries may:

  • Compress images to reduce bandwidth
  • Convert image formats (e.g., JPEG to WebP)
  • Minify HTML, CSS, or JavaScript
  • Inject content (ads, analytics scripts)
  • Transcode video to lower quality

When Intermediaries Modify Content

Mobile carriers are the most common offenders. To save bandwidth, they may:

Original:    high-quality-photo.jpg    (500 KB)
Modified:    high-quality-photo.jpg    (150 KB, recompressed)

This saves bandwidth but degrades quality. For a photography portfolio or medical imaging application, this is unacceptable.

The Fix

Cache-Control: no-transform

This tells all intermediaries: "Deliver the response exactly as the origin server sent it. Do not modify the body, content-encoding, content-type, or content-length."

Common Use Cases

Image-critical applications:

Cache-Control: public, max-age=86400, no-transform

Photography sites, medical imaging, design tools

API responses with integrity requirements:

Cache-Control: private, no-cache, no-transform

Cryptographic data, signed payloads, binary protocols

Already-optimized assets:

Cache-Control: public, max-age=31536000, immutable, no-transform

Pre-optimized images (already WebP/AVIF), pre-minified code

Combining with Other Directives

no-transform can be combined with any other directive. It only affects the body transformation behavior, not caching duration or visibility:

Cache-Control: public, max-age=86400, no-transform
Cache-Control: private, no-cache, no-transform
Cache-Control: no-store, no-transform

Modern Relevance

With the rise of HTTPS, carrier-level content modification has declined (they can't modify encrypted traffic). However, no-transform remains important for:

  • HTTP connections (still used in some internal networks)
  • CDN-level optimizations (Cloudflare Polish, AWS CloudFront image optimization)
  • Corporate proxy servers

Use Case

A radiology department's web-based DICOM viewer serves medical images that must be pixel-perfect for diagnosis. Setting 'no-transform' prevents any intermediary from recompressing the images. Combined with 'private, no-cache', the images are always fetched fresh and unmodified, ensuring diagnostic accuracy is never compromised by bandwidth optimization.

Try It — Cache-Control Builder

Open full tool