Compress a binary blob served as worker asset
I have a binary blob that's served as worker asset as part of a react vite app.
I want to compress it before it is sent as it can reduce the size by a lot. Apparently server on
wrangler dev is compressing the blob but not when it is deployed to the worker. How can I compress it? The attached screenshots show the difference when it is served on localhost vs production

10 Replies
👀 the screenshots both look like they’re localhost
oops i mispasted

sorry for deleting and resending, had to censor the name of the worker
Is this with a custom domain? Idk if compression is enabled on the
workers.dev zoneno, not it's workers.dev. I can try it with a custom domain as well
well, i'm getting it on localhost. which is what confuses me
right. what I would expect to happen is worker returns a compressed blob that is then distributed by the CDN
is that incorrect?
The other way around. The Worker returns an uncompressed blob, the CDN compresses and distributes it
ah i see
is there any way to force compression on these assets, like how localhost is doing?
Have you tried what Leo suggested, and give it a different content-type?
yeah, cbor apparently isn't one of the types that is compressed by just setting the content-type, according to docs: https://developers.cloudflare.com/speed/optimization/content/compression/
the question now really is how I would be able to force the cbor to be compressed
oh i see, thank you for pointing me to that