Brotli makes jsons larger

Hi team,

I’m seeing a really big difference when using the Brotli compressions feature when accessing a web API which returns a json object.
Without Brotli: 17.5K
With Brotli: 188K

Here are the headers for each request:

Without Brotli -

  • General
    • Request Method: POST
    • Status Code: 201
    • Remote Address: 104.27.179.88:443
    • Referrer Policy: no-referrer-when-downgrade
  • Response Headers
    • access-control-allow-origin: *
    • cf-cache-status: DYNAMIC
    • cf-ray: 54b3e8cf7d67f3f7-LHR
    • content-encoding: gzip
    • content-length: 17710
    • content-type: application/octet-stream
    • date: Thu, 26 Dec 2019 14:57:50 GMT
    • etag: W/“452e-P3xYb/ZuNXJpEpOhrRADa4uXHHQ”
    • expect-ct: max-age=604800, report-uri="???"
    • server: cloudflare
    • set-cookie: token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
    • set-cookie: tokenExpiration=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
    • status: 201
    • strict-transport-security: max-age=15552000; includeSubDomains
    • vary: Accept-Encoding
    • via: 1.1 vegur
    • x-content-type-options: nosniff
    • x-dns-prefetch-control: off
    • x-download-options: noopen
    • x-frame-options: SAMEORIGIN
    • x-xss-protection: 1; mode=block
  • Request Headers
    • :authority: ???
    • :method: POST
    • :path: /api/search/catalogSearch
    • :scheme: https
    • accept: application/json, text/plain, /
    • accept-encoding: gzip, deflate, br
    • accept-language: he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7
    • access-control-allow-origin: *
    • cache-control: no-cache
    • content-length: 214
    • content-type: application/json
    • pragma: no-cache
    • sec-fetch-mode: cors
    • sec-fetch-site: same-origin
    • user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

=============================================
With Brotli:

  • General
    • Request Method: POST
    • Status Code: 201
    • Remote Address: 104.27.178.88:443
    • Referrer Policy: no-referrer-when-downgrade
  • Response Headers
    • access-control-allow-origin: *
    • cf-cache-status: DYNAMIC
    • cf-ray: 54b3f64c5a92bbe2-LHR
    • content-type: application/octet-stream
    • date: Thu, 26 Dec 2019 15:07:02 GMT
    • etag: W/“452e-4yY4ImxLRSDoi+MqRFgH0nss+OM”
    • expect-ct: max-age=604800, report-uri="???"
    • server: cloudflare
    • set-cookie: token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
    • set-cookie: tokenExpiration=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT
    • status: 201
    • strict-transport-security: max-age=15552000; includeSubDomains
    • vary: Accept-Encoding
    • via: 1.1 vegur
    • x-content-type-options: nosniff
    • x-dns-prefetch-control: off
    • x-download-options: noopen
    • x-frame-options: SAMEORIGIN
    • x-xss-protection: 1; mode=block
  • Request Headers
    • :authority: ???
    • :method: POST
    • :path: /api/search/catalogSearch
    • :scheme: https
    • accept: application/json, text/plain, /
    • accept-encoding: gzip, deflate, br
    • accept-language: he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7
    • access-control-allow-origin: *
    • cache-control: no-cache
    • content-length: 214
    • content-type: application/json
    • pragma: no-cache
    • sec-fetch-mode: cors
    • sec-fetch-site: same-origin
    • user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

Can you help me understand what’s going on?
Thanks

The second one isn’t using Brotli. Otherwise there’d be a content-encoding:br header.

I’m not a real expert on this… only thing I see is once I turn on Brotli I get 188K response instead of 17.5K