Precompressed Brotli File in Workers Static Asset is not decompressed properly
Previously I have been putting .js.br file in Cloudflare Pages (React+Vite, linked to git and run build script in Pages)
I'm migrating to Workers, but when I put the same file in public folder, even with _headers (same as when using Pages) set to:
when the file is fetched, I get jumbled Response instead of the normally decompressed js file. The Response Headers have the content-encoding : br and content-type : application/javascript
wrangler.jsonc:
In the local environment the file works.
Not sure what I'm missing here. Thanks in advance!
Edit: It seems the one in Pages has "Content-Length" header, while in workers there isn't any. Is there a way to ensure there is one?

4 Replies
I'm a little confused, you're requesting a Brotli file and getting Brotli back with the appropriate content-encoding header. That sounds correct?
Yes, but I'm using Unity so it seems that Content-Length header is also required. When I was using Pages it was there. Usually the response in Network tab is already decompressed.
Then I'd get
Can you share the url to test? Content-Length is generally not there for compressed content (which is fully spec compliant)
That error seems to just want CE br which you have
Chrome should be decompressing it though so wonder if it's actually bad data...
url sent in DM