mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[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') https://github.com/nodejitsu/node-http-proxy/issues/250
This commit is contained in:
parent
f223ce8b4e
commit
ca37ad7436
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user