Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fix] Ensure response.headers.location is defined. Fixes #276.
  • Loading branch information
indexzero committed Mar 9, 2013
1 parent deca756 commit 013cb2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/node-http-proxy/http-proxy.js
Expand Up @@ -247,7 +247,8 @@ 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') {
if (self.source.https && !self.target.https) {
response.headers.location = response.headers.location.replace(/^http\:/, 'https:');
}
Expand Down

0 comments on commit 013cb2e

Please sign in to comment.