aldenks
aldenks
CDCloudflare Developers
Created by aldenks on 5/5/2025 in #workers-help
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?
2 replies