No Content-encoding header for application/transit+json content type

Hi,
I have a Clojure app which uses Content-Type: application/transit+json; charset=utf-8 headers for sending the data. The app server sets the content-encoding to gzip, but in the browser content-encoding is not set for results with this content type, see the picture below
Selection_207
When I copy the very same request as cURL and run it, I see the proper header in the results -

* upload completely sent off: 12 out of 12 bytes
< HTTP/1.1 200 OK
< Date: Mon, 26 Dec 2022 09:50:33 GMT
< Content-Type: application/transit+json; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< content-encoding: gzip
< CF-Cache-Status: DYNAMIC
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=5HtOgUEN0tiny%2BRZ%2BPdRLMbF0LogmRvp%2FRuKNY7vciVVKl%2Finz%2FkombX%2BCR2gW%2BfW4U7pB3NIwHTq%2BXJfN8B5P5QJS23BWfkotTTrA6UJI%2F1zF81Y8MZYsVcI5yX"}],"group":"cf-nel","max_age":604800}
< NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< Server: cloudflare
< CF-RAY: 77f8e9b25857690a-FRA
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

I know that application/transit+json is not supported by auto compression feature in Cloudflare, but why doesn’t it work when the headers are already set?

Cloudflare needs to decompress all content so that it can dynamically recompress it depending on the client’s support for it (e.g. some clients don’t support compression, some prefer brotli to gzip etc). That’s why you don’t see gzip happening because as you’ve identified that type is not compressed by us:

https://support.cloudflare.com/hc/en-us/articles/200168396-What-will-Cloudflare-compress-

You can try setting cache-control: no-transform at your origin, but I haven’t tested this in your scenario where you want origin gzip to be returned without any changes.

1 Like

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