Static files are being served with Gzip instead of Brotli

For Workes & Pages, what is the name of the domain?

What is the issue or error you’re encountering

Browsers are getting gzipped static files where Brotli is expected even if the request accepts br compression or the uploaded files have *.br file versions

What are the steps to reproduce the issue?

  1. Go to Chrome dev tools
  2. Network tab
  3. Click on any javascript file of the same origin
  4. Look for the request and response headers
  5. Check that content encoding response header is not Brotli

Screenshot of the error

I believe that if the server returned it as gzip for a request that specified gzip, then that’s what any other request that can accept gzip will get.

However, if your request will only accept br, then Cloudflare will recompress it, taking a bit of time to do so, and that’s what you’ll get.

Something like this can demonstrate the behavior:

curl -svo /dev/null "https://pomodorotimer.online/_nuxt/d18d4af.js" -H "Accept-Encoding: br,gzip"

You’ll probably get the already-cached gzip. But drop gzip from accept-encoding, and Cloudflare will force brotli for you.

If you’re on an Enterprise Plan, you’d be able to use a Compression Rule to customize this behavior, and put the compression methods in a preferred order.

Thanks for your quick response, man. I tested it as you mentioned, and indeed, if I only accept br, then CF returns the correct one. I’m not on the Enterprise plan, and upgrading only for compressing ordering seems a bit much. Do you know by chance if there is any alternative?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.