CDN Brotli compression

Compress eligible HTML, JavaScript, CSS and other text assets. Verify the content encoding returned to clients with different compression support.

Negotiating compression
Request header
Accept-Encoding: br, gzip
Response header
Content-Encoding: br
Cache varies by
Accept-Encoding

Negotiate compression for text responses

Cloud CDN applies Brotli and Gzip for eligible text responses. Clients get the encoding they support. Already-compressed images and binaries are left alone.

Smaller HTML, JS and CSS

Brotli typically beats Gzip on text without changing the source files.

Compression at the edge

Origin can send uncompressed or Gzip; the client still sees Brotli when it asks for it.

Every PoP, same policy

You do not enable compression on one region only.

Configuration

Cloud CDN overview
  1. Deliver text through Cloud CDN

    HTML, JS, CSS, SVG and JSON are the usual candidates.

  2. Leave media alone

    JPEG, WebP, MP4 and zip files should not be recompressed.

  3. Confirm Content-Encoding

    Check that browsers receive br or gzip on a test hostname.

  4. Combine with hashed filenames

    Compressed hashed assets can use long TTLs.

Operational outcomes

  • Text assets are Brotli or Gzip encoded
  • Images and binaries are not double-compressed
  • Origin compression is optional
  • Hashed files stay long-cacheable

Frequently asked questions

Should the origin also compress?

It can. Cloud CDN still negotiates with the client. Avoid compressing already-compressed formats.

Does Brotli help APIs?

Yes for JSON and other text API bodies that are cacheable or still pass through the edge.

What about HTTP/3?

Compression and HTTP/3 stack. See the HTTP/3 CDN page.

Can I disable compression for a path?

Use path-specific behaviour when a client cannot handle encoded responses. Most browsers can.