1

I'm using Node.js/express and if I set the headers

Content-Type: application/json Content-Encoding: gzip 

and send gzipped compressed bodies of JSON data, this works as expected - when not behind Cloudflare.

But if behind Cloudflare and with Brotli compression enabled in the settings, Cloudflare unpacks my gzipped data and sends it to the client compressed it as brotli.

The Cloudflare documentation claims that encoding headers are respected and compression is avoided in in case of gzip or other compression.

Of course, Cache-Control: no-transform "fixes" the issue. But why should this be needed? Is this a Cloudflare bug or am I doing something wrong?

1 Answer 1

1

From the docs:

Cloudflare will return brotli-reencoded responses to compatible clients / browsers for the following content-types:

text/html text/richtext text/plain text/css text/x-script text/x-component text/x-java-source text/x-markdown application/javascript application/x-javascript text/javascript text/js image/x-icon image/vnd.microsoft.icon application/x-perl application/x-httpd-cgi text/xml application/xml application/xml+rss application/vnd.api+json application/x-protobuf application/json multipart/bag multipart/mixed application/xhtml+xml font/ttf font/otf font/x-woff image/svg+xml application/vnd.ms-fontobject application/ttf application/x-ttf application/otf application/x-otf application/truetype application/opentype application/x-opentype application/font-woff application/eot application/font application/font-sfnt application/wasm application/javascript-binast application/manifest+json application/ld+json application/graphql+json application/geo+json 

If you do not want a particular response from your origin to be (re-)encoded, you have to disable this by setting the cache-control: no-transform header.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.