How to force gzip compression when accept header is not supported?

When using a service hosted by Cloudflare, like my real case (, which uses the Accept header in a custom way (with the value application/vnd.npm.install -v1+json), Cloudflare becomes unable to compress the response in gzip, as it uses just the same header types to compress (such as application/json).

My question is: is there any way to force compression via gzip, even when the Accept header is not supported? Even sending Accept-Encoding: gzip this is not being respected.

What is the request you’re sending?

Sending a request with that accept and accept-encoding header to that URL results in a GZIP response.

You could try:

curl --location --request GET '' \
     --header 'Accept-Encoding: gzip' \
     --header 'Accept: application/vnd.npm.install-v1+json'

The response will not have a Content-Encoding: gzip. But if you drop the Accept from request header, then it will have. But it changes de content behaviour, because the Registry NPM API needs that exactly as application/vnd.npm.install-v1+json.