0

I have a database query tool that returns data with Transfer-encoding: chunked. I'd like to use existing varnish infrastructure to cache responses from this tool, but varnish refuses to cache chunked documents. Between varnish and the tool itself, there's nginx proxy but I could not find any way to make it un-chunk the responses. Is there a solution for nginx or any other likewise proxy, that basically would do the following:

  1. Take the response from the backend, and if it is chunked, buffer it up to preset size
  2. If the response ends before the limit is reached, repackage it as a single object without chunking and send it out with proper Content-Length
  3. If the response does not end, send the accumulated data out (with original chunks or as one big chunk) and continue streaming it out from that point forward.
StasM
  • 163
  • 1
  • 1
  • 7

0 Answers0