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) {