node.js - node-http-proxy How to proxy pdfkit response? -


i'm trying figure out how proxy request of pdf file generated @ runtime pdfkit.

response headers of backend service set to

res.setheader('content-type', 'application/pdf');  // if req.params.view != undefined  res.setheader('content-disposition', 'attachment; filename=' + req.params.template + '_' + id + '.pdf');

this allows view pdf inside browser (by sending out first header) or download sending second header.

while pdfkit generates file piped response. if try contacting backend directly works, while using proxy it's raising econnreset error.

i guess might depend on client terminating request before receive chunked response, how can allow backend service pipe request backend processing pdf?

i'm surely missing something... thank you!!


Comments