Cloudflare's Automatic Compression: A Streaming Nightmare

2025-08-09
Cloudflare's Automatic Compression: A Streaming Nightmare

The Mintlify team encountered a frustrating issue with HTTP streaming using Node's stream API and an AI SDK: cURL and Postman worked, but node-fetch and browser fetch failed. Debugging revealed a Cloudflare Worker as a temporary fix, ultimately tracing the problem to Cloudflare automatically enabling compression. Browsers' default inclusion of the Accept-Encoding header caused the compressed response to break. Disabling compression in Cloudflare resolved the issue. This highlights the potential pitfalls of Cloudflare's "intelligent" defaults, underscoring the importance of Infrastructure-as-Code and traceability.

Development HTTP streaming