remoteAddress priority... and whitespace... ooops

This commit is contained in:
AJ ONeal 2017-04-27 17:00:09 -06:00
parent 4b470ffe51
commit 350d87c38d
1 changed files with 161 additions and 159 deletions

View File

@ -62,7 +62,7 @@ module.exports.create = function (deps, config) {
// XXX SECURITY XXX: should strip existing X-Forwarded headers
newHeads =
[ "X-Forwarded-Proto: " + (opts.encrypted ? 'https' : 'http')
, "X-Forwarded-For: " + (conn.remoteAddress || opts.remoteAddress)
, "X-Forwarded-For: " + (opts.remoteAddress || conn.remoteAddress)
, "X-Forwarded-Host: " + hostname
];
@ -127,6 +127,8 @@ module.exports.create = function (deps, config) {
var packerStream = require('tunnel-packer').Stream;
var myDuplex = packerStream.create(socket);
myDuplex.remoteAddress = opts.remoteAddress || myDuplex.remoteAddress;
myDuplex.remotePort = opts.remotePort || myDuplex.remotePort;
console.log('[tlsRouter] ' + address + ':' + port + ' servername', servername, myDuplex.remoteAddress);
// needs to wind up in one of 3 states: