Skip to content

Commit

Permalink
refactored res.redirect() with req.protocol()
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 7, 2012
1 parent 2ba343d commit 8de3ad5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/response.js
Expand Up @@ -485,11 +485,8 @@ res.redirect = function(url){
}

// Absolute
var host = req.header('Host')
, proto = req.header('X-Forwarded-Proto')
, tls = 'https' == proto || req.secure;

url = 'http' + (tls ? 's' : '') + '://' + host + url;
var host = req.header('Host');
url = req.protocol(true) + '://' + host + url;
}

// Support text/{plain,html} by default
Expand Down

0 comments on commit 8de3ad5

Please sign in to comment.