I have a Node.js app that uses Transfer-Encoding: Chunked
to stream data over HTTP continuously until the client disconnects. When running a local instance of Node, it works fine, but when deployed to an Azure App Service (which runs Node apps through iisnode), client connections hang without ever receiving data.
Logging indicates that the Node app is processing requests and streaming data correctly, but for some reason that data is not reaching the client.
Here's a simplified example of the way I'm streaming data from Node:
var server = http.createServer();
server.on('request', function(request, response) {
var interval = setInterval(function() {
response.write("some data\r\n");
}, 1000);
request.on('close', function() {
clearInterval(interval);
});
});
server.listen(config.port);
In my iisnode.yml
config file I have set flushResponse: true
to prevent iisnode from buffering response chunks.
My guess is that IIS is trying to buffer the entire response before sending it, but I don't know how to disable this behavior.