Skip to content

Commit

Permalink
[fix] x-forwarded-proto sets properly
Browse files Browse the repository at this point in the history
The ternary was evaluating truthy for "," + req.connection.pair which is always true because its always a non empty string.  Wrapped actual condition to properly concatenate the product of the ternary.  let me know if you prefer the style   (req.connection.pair ? 'https' : 'http')

#250
  • Loading branch information
ryanstevens authored and jfhbrook committed May 22, 2012
1 parent f223ce8 commit ca37ad7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/node-http-proxy/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
}

if (req.headers['x-forwarded-proto']){
var protoToAppend = "," + req.connection.pair ? 'https' : 'http';
var protoToAppend = "," + (req.connection.pair) ? 'https' : 'http';
req.headers['x-forwarded-proto'] += protoToAppend;
}
else {
Expand Down Expand Up @@ -415,7 +415,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
}

if (req.headers['x-forwarded-proto']){
var protoToAppend = "," + req.connection.pair ? 'wss' : 'ws';
var protoToAppend = "," + (req.connection.pair) ? 'wss' : 'ws';
req.headers['x-forwarded-proto'] += protoToAppend;
}
else {
Expand Down

0 comments on commit ca37ad7

Please sign in to comment.