Streaming response breaks on one Cloudflare account, but not the other

I've discovered that streaming is broken for a cloudflare worker, but only in one of my accounts. Working deployment: https://tss-streaming.jakst.workers.dev/ (streaming works on every request) Broken deployment: https://tss-streaming.jn-endform.workers.dev/ (streaming only works on every ~10-20th request or so) What I've discovered is that the difference seems to be the encoding that get's applied. On the working version, all requests respond with header Content-Encoding: zstd, while on the broken version it responds with Content-Encoding: br on the requests where streaming breaks, and zstd in the ones where it works. This is super odd to me. Why does streaming break when using brotli? Why does the Cloudflare switch between two different encodings in one of my accounts? How do I force the encoding in the broken version to always be zstd?
No description
No description
6 Replies
Walshy
Walshy3w ago
zstd/brotli itself won't break streaming but what may is some response rewrite features, things like email obfuscation, minify, etc. also make sure response buffering is disabled: https://developers.cloudflare.com/network/response-buffering/
Jakob Norlin
Jakob NorlinOP3w ago
Response buffering is disabled Could there be any other setting interfering? The account where streaming breaks most times is an enterprise account, while the one where it always works is a regular $5 / month account
Walshy
Walshy3w ago
have you checked response rewrite features?
Jakob Norlin
Jakob NorlinOP3w ago
No, but I've never added one of those. Where would I locate them in the dashboard? Correction: the breaking one isn't on the enterprise account. It' on the personal account that got created together with our company enterprise account. So I guess it's on the free tier And none of these are deployed under a domain. They are just deployed to workers.dev domains, so turning the knobs on settings for a specific domain shouldn't change anything for them, right?
Walshy
Walshy3w ago
yeah zone settings won't change workers.dev, workers.dev domains can definitely stream by default though: https://test.walshydev.workers.dev/stream-response
Jakob Norlin
Jakob NorlinOP3w ago
Yeah I know, because one of the deployments works ^^ Isn't it weird that the other one works once every ~20th request or so? The other times it just holds the request Ok I just deployed it to our enterprise account, where it also works every time. So I've got: * Broken deployment on my work email account, which should be on the free tier * Working deployments on our enterprise company account, and on my personal $5 / month account Actually it really seems to be the encoding, or at least something triggered by which encoding is selected. Visiting https://tss-streaming.jakst.workers.dev/ from Chrome, streaming works (and zstd is used since Chrome supports it). If I visit the same from Safari, br is used on every request and streaming breaks So I'd still like to find out: * Why does one of my accounts switch between zstd and br on different requests from the same Chrome browser on the same Computer? * Why does streaming break when the worker uses brotli encoding?

Did you find this page helpful?