I have a simple node application which handles GET /foo
. This request takes some time to compute and return a file.
Each time the request lasts more than 2 minutes, the connection is closed. I'm using Express 4.10.2 and node 0.10.32.
I read that http module has a default timeout of 2 minutes: http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/
I tried to use:
server.on('connection', function(socket) {
socket.setTimeout(5*60*1000); //5 minutes
});
But even if the connection is not closed after two minutes, when the server tried to send the file back, I got:
{ [Error: Request aborted] code: 'ECONNABORT' }
EDIT:
server.setTimeout(5*60*1000);
works fine! Thanks @mscdex