diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index 8d0fc47..056236e 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -111,8 +111,8 @@ web_o = Object.keys(web_o).map(function(pass) { // allow outgoing socket to timeout so that we could // show an error page at the initial request - if(options.targetTimeout) { - proxyReq.setTimeout(options.targetTimeout, function() { + if(options.proxyTimeout) { + proxyReq.setTimeout(options.proxyTimeout, function() { proxyReq.abort(); }); } diff --git a/test/lib-http-proxy-passes-web-incoming-test.js b/test/lib-http-proxy-passes-web-incoming-test.js index 8d2adfe..93c76ca 100644 --- a/test/lib-http-proxy-passes-web-incoming-test.js +++ b/test/lib-http-proxy-passes-web-incoming-test.js @@ -128,10 +128,10 @@ describe('#createProxyServer.web() using own http server', function () { }, function() {}).end(); }); - it('should proxy the request and handle timeout error (targetTimeout)', function(done) { + it('should proxy the request and handle timeout error (proxyTimeout)', function(done) { var proxy = httpProxy.createProxyServer({ target: 'http://127.0.0.1:45000', - targetTimeout: 100 + proxyTimeout: 100 }); require('net').createServer().listen(45000);