cloudflare proxy doesnt stream responses

i have a sveltekit app hosted on fly.io, using cloudflare proxy/cdn for caching. with sveltekit you can stream data for your page so that slow loading data can be continually loaded without slowing the page down. when using the cloudflare proxy, that isnt working for me. cloudflare proxy url: https://fly.nypsi.xyz/leaderboard fly url: https://nypsi-website.fly.dev/leaderboard as you can see by clicking through the different leaderboards, the fly version works as its supposed to, but on the cloudflare proxied url, there is no content update until the data has loaded. is this something that can be fixed?
4 Replies
max
maxOP2mo ago
it seems to be something related to a cache rule, when its disabled streaming works, when enabled, streaming doesnt work.
No description
erehwonmi
erehwonmi2mo ago
What headers are you using? I have a similar problem, like I tried everything but nothing seems to work lmao. I have this response headers and I'm using NextJS 14. const stream = new ReadableStream({ // append events here.... }) return new NextResponse(stream, { headers: { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive', 'Transfer-Encoding': 'chunked', }, }); Also when I access my site directly without Cloudflare (direct VPS access) it works. :NotLikeThis:
zruilong
zruilong2mo ago
I am facing the same problem when generating a report csv using ActionController::Live on my rails server. When not behind cloudflare, it works fine. In desperation, I thought maybe I had to allow for streaming content (like the video content), so I took a shot and enabled video ($5 is worth the risk) - but everything there seems to be completely oriented for video/audio streaming and not additional controls for general chunked responses. I have tried Content-Type text/event-stream, application/octet, text/csv with no-cache, chunked transfer encoding. I also have tried to bypass cache like OP. I also set X-Accel-Buffering: no
zruilong
zruilong2mo ago
I came across this, but won't have time to get to it for a while: https://www.npmjs.com/package/@cfworker/csv
npm
@cfworker/csv
Streaming CSV encoding for Cloudflare Workers and service workers. Latest version: 3.0.0, last published: 21 hours ago. Start using @cfworker/csv in your project by running npm i @cfworker/csv. There are no other projects in the npm registry using @cfworker/csv.
Want results from more Discord servers?
Add your server