Cloudflare DevelopersCD
Cloudflare Developers9mo ago
3 replies
aldenks

How to stream responses and return a known content length?

I'm using workers as a thin proxy with a little bit of logic between object storage (s3 in this case, but in the future likely r2) and clients.

I'm wondering how to support sending data back with a content length header but without buffering the full object in memory? When I return a response with a stream, workers transforms the response to Transfer-Encoding: chunked and removes the Content-Length header to conform to the http spec.

There's a great http client (object_store) I'd like to support with this proxy, but it requires content length headers. When i asked there about transfer encoding chunked support they said nope (https://github.com/apache/arrow-rs-object-store/issues/340#issuecomment-2849485808). Any suggestions?
GitHub
Is your feature request related to a problem or challenge? Please describe what you are trying to do. I'm not able to use the HttpStore to read data returned with Transfer-Encoding: chunked. In...
Was this page helpful?