Taking advantage of brotli compression
I have a pages site that I have a pipeline configured to pre-compress assets with the highest levels of gzip and brotli compression, and I want to serve those with cloudflare pages. Is there any specific configuration I have to set to serve those if the user agent can receive it? thank you!
12 Replies
Hi there! I also experienced the same issue. Even if I have br-filles generated like:
- index.html
- resource.js
- resource.js.br
CF seems to serve always Gzipped files, I've read in the docs that a new feature called
CF Compression Rules
has been release but I cannot find the option on my dashboard, I guess it is because my Free Plan since it is only available in Enterprise plan: https://developers.cloudflare.com/rules/compression-rules/Cloudflare Docs
Compression Rules · Cloudflare Rules docs
Use Compression Rules to customize the compression applied to responses from Cloudflare’s global network to your website visitors, based on the file …
Please let me know if you find some alternative
@Pipoca @mrparker did you ever find an solution?
it's quite frustrating that the documentation references dashboard pages that do not exist, and the
_headers
file does not respect the cache-control, content-type, content-encoding, OR, and this is the primary reason I am pre-compressing, the content-length header.No unfortunately
Me neither. I posted a question and apparently we need Enterprise plan to enable more options on the headers. In my opinion having Enterprise plan for those cases is too much 😒
Pages already compresses assets internally afaik, and the fact that it goes through two compression configs on a custom domain (your own, and then the pages.dev) really complicates things. Afaik there was some really hacky way to "kind of" get it working although it may still have been recompressing internally
Compression Rules are rolling out to free plan if that's what you're talking about https://developers.cloudflare.com/rules/compression-rules/#availability
Cloudflare Docs
Compression Rules | Cloudflare Rules docs
Use Compression Rules to customize the compression applied to responses from Cloudflare’s global network to your website visitors, based on the file extension and content type. Compression Rules are powered by the Ruleset Engine.
OMG, that amazing. Thank you for the information!
https://blog.cloudflare.com/new-standards/
From two hours ago! @Pipoca @mrparker
The Cloudflare Blog
New standards for a faster and more private Internet
Cloudflare's customers can now take advantage of Zstandard (zstd) compression, offering 42% faster compression than Brotli and 11.3% more efficiency than GZIP. We're further optimizing performance for our customers with HTTP/3 prioritization and BBR congestion control, and enhancing privacy through Encrypted Client Hello (ECH).
...oh nvm