Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] x-forwarded-proto sets properly

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...
commit ca37ad74367764cca479a1af63bd7491dc79606b 1 parent f223ce8
@ryanstevens ryanstevens authored jfhbrook committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/node-http-proxy/http-proxy.js
View
4 lib/node-http-proxy/http-proxy.js
@@ -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 {
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.