Can I pre-compress a file to provide a Content-Length header?
As taken from https://community.cloudflare.com/t/no-content-length-header-when-content-type-gzip/492964/2 it appears Content-Length is generally unavailable for cloudflare pages objects as they are transparently compressed and delievered without knowing the final size of the content.
I have a rather large WASM file that I'm wanting to display a loading bar for as it is downloaded to a browser from cloudflare pages. While I could likely (?) solve this by disabling compression for the file, the savings from compressing it are quite significant. Is it possible that I could precompress the file with brotli and provide the headers like so?
_headers
If I do this-- will I get a Content-Length response for that file from Cloudflare Pages? Thanks!2 Replies
This appears to work fine-- but provides the file only as
wasm.br
. So I must download an additional dependency to decompress the wasm in my javascript code.
If I instead just name the file myfile.wasm
and set the headers for that instead, it seems to not respect the headers any longer.
I get no Content-Length header and given that I cannot run the wasm download, and I get magic number errors: expected magic word 00 61 73 6d, found cf ff ff 7f @+0
-- it appears to be recompressed on cloudflare's side, and only one layer is decompressed by my browser.facing this same problem? Did you managed to solve it?