From c9b6895c5e14add6aba4f826a2173458a1896a5f Mon Sep 17 00:00:00 2001 From: thefosk Date: Thu, 14 Mar 2013 19:09:03 -0700 Subject: [PATCH] Fixing the if statement as it lead to 'TypeError: Parameter 'url' must be a string, not undefined' in certain cases --- lib/node-http-proxy/http-proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 5ec206e14..fde610c53 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -268,7 +268,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { delete response.headers['transfer-encoding']; } - if ((response.statusCode === 301) || (response.statusCode === 302) + if ((response.statusCode === 301 || response.statusCode === 302) && typeof response.headers.location !== 'undefined') { location = url.parse(response.headers.location); if (location.host === req.headers.host) {