How to enable brotli compression on a different file type

On my site I serve several large .bin files. (Pieces of gltf formatted 3D models.)

  1. Can CloudFlare brotli-compress them even though they are not on the What will CloudFlare Compress list? I mean I could override the mime type for those files to be one of the matching, but would that work? If so, can I have CloudFlare use the highest compression level?

I suspect the only answer is from someone that’s tried or to try it. I’ve not attempted this with brotli, tried something similar with other formats but could never get the format right.

1 Like

I’d ask the question as to whether optimising bin file extension sizes is all that important to begin with. Sure brotli at highest level compression has much smaller compressed file size versus gzip from my comparison benchmarks of various compression algorithms like gzip, xz, lzip, bzip2, brotli and multi threaded pigz, pxz, plzip, pbzip2, lbzip2 and zstd https://community.centminmod.com/threads/round-4-compression-comparison-benchmarks-zstd-vs-brotli-vs-pigz-vs-bzip2-vs-xz-etc.18669/.

But as these .bin files wouldn’t be natively loaded by a page’s HTML page, it isn’t going to affect page load speed as such.

And as you’re serving them from Cloudflare, it isn’t going to impact your bandwidth usage costs besides the initial non-cache hit/missed fetch from your origin. So only benefit is how long it takes a visitor to download the .bin files themselves. If you’re offering up .bin files for download, then using more common bzip2 or xz would be better in pre-compressed downloads i.e. .bin.xz or .bin.bzip2 files.

Not familiar with gltf formatted files but google search says they’re basically json files ?? So I guess highly compressible ? Tried using gzip compression using higher compression based Zopfli compression format ? pigz multi-threaded gzip can use Zopfli compression at level 11 specific compression level and the resulting .gz compressed file is easily decompressed with web browsers via gzip.

1 Like