Discussion about adding brotli compression to Sanity's CDN
Great question! Based on the conversation history from the Sanity community, Brotli compression is already supported on Sanity's infrastructure, though the rollout happened in different phases.
Here's what's currently supported:
API CDN / Live CDN: Brotli compression was added in March 2021 for content API responses (your GROQ query results). You can verify this by looking for content-encoding: br in the response headers when your client sends Accept-Encoding: br.
Asset CDN: Brotli compression is also supported for media assets served through cdn.sanity.io, including images, videos, and SVGs. The Asset CDN documentation mentions that both Brotli and Gzip compression are supported, with the CDN automatically choosing the best compression based on what your client's browser supports via the Accept-Encoding header.
The implementation is pretty seamless - assets are compressed with Brotli when cached in Varnish, and automatically transcoded to Gzip if the client doesn't support Brotli. According to the team's testing, performance impact is negligible (around 1ms during the initial cache fetch), and compression improvements can range from 6% to 25% depending on the content type, with SVGs seeing particularly good results.
So you should already be getting Brotli compression automatically if your HTTP client is sending the appropriate Accept-Encoding headers! No configuration needed on your end.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.