#*worker noob* In search of the proper way to serve brotli compressed version of my gltf/glb files

2 messages · Page 1 of 1 (latest)

lilac wharf
#

Greetings from Mexico!

I built a website on CF Pages that uses three.js.

There is quite an improvement in the size of my 3D models when I brotli-compress them locally. I am using vite as my build tool and even though the .glb files get brotli-compressed as part of my building process, CF Pages won't serve the compressed version...

The CF docs say that model/gltf-binary is not included in the mime types that get automatically compressed:

https://support.cloudflare.com/hc/en-us/articles/200168396-What-will-Cloudflare-compress-

Someone else had this issue before and it seems a solution might be to "udpate (via workers) the mime on our gltf files to application/json to allow gzip / brotli":

https://community.cloudflare.com/t/how-to-enable-brotli-compression-on-a-different-file-type/142742/4?u=wwwonka

I'm asking you, is that the proper solution?
How can I setup such a worker?
Can you help me sort this out?

small halo
#

You can use a Transform Rule to modify the response headers - it's free and much easier to implement than using Workers or Functions.