Decompressing WASM or turning off .wasm compression on the edge

Hello, I’m working on a game that could really get some legs with streaming compilation of web assembly. In order for streaming web assembly to work, my impression is that it cannot be compressed by Cloudflare, but of course that is exactly what it does with .wasm files.

I’m thinking that I could decompress the response in a worker and cache the result, but I’m Cloudflare worker newbie. Firstly is a Cloudflare worker to decompress the response the correct approach? Would anyone know the best way or have an example of decompressing either a brotli or gzipped file in a Cloudflare worker?

Thanks for any help!
Curt

Setting a Cache-Control: no-transform header should stop Cloudflare from doing anything to the file, I believe.

Ah that’s helpful thanks. Turns out that if I upload the wasm file uncompressed to s3 (the origin), then Cloudflare only compresses it once, and the browser decompresses it on the way down. To get it to compress other file types (like .unityweb) I just needed to set the content-type of that file on the origin to something Cloudflare thinks it needs to compress by default. So I think I have my solution.