@@ -134,23 +134,23 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
134
134
// * `x-forwarded-port`: Port of the original request.
135
135
//
136
136
if ( this . enable . xforward && req . connection && req . socket ) {
137
- if ( req . headers [ 'x-forwarded-for' ] ) {
137
+ if ( req . headers [ 'x-forwarded-for' ] ) {
138
138
var addressToAppend = "," + req . connection . remoteAddress || req . socket . remoteAddress ;
139
139
req . headers [ 'x-forwarded-for' ] += addressToAppend ;
140
140
}
141
141
else {
142
142
req . headers [ 'x-forwarded-for' ] = req . connection . remoteAddress || req . socket . remoteAddress ;
143
143
}
144
144
145
- if ( req . headers [ 'x-forwarded-port' ] ) {
145
+ if ( req . headers [ 'x-forwarded-port' ] ) {
146
146
var portToAppend = "," + req . connection . remotePort || req . socket . remotePort ;
147
147
req . headers [ 'x-forwarded-port' ] += portToAppend ;
148
148
}
149
149
else {
150
150
req . headers [ 'x-forwarded-port' ] = req . connection . remotePort || req . socket . remotePort ;
151
151
}
152
152
153
- if ( req . headers [ 'x-forwarded-proto' ] ) {
153
+ if ( req . headers [ 'x-forwarded-proto' ] ) {
154
154
var protoToAppend = "," + getProto ( req ) ;
155
155
req . headers [ 'x-forwarded-proto' ] += protoToAppend ;
156
156
}
@@ -302,7 +302,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
302
302
} ) ;
303
303
304
304
// Set the headers of the client response
305
- Object . keys ( response . headers ) . forEach ( function ( key ) {
305
+ Object . keys ( response . headers ) . forEach ( function ( key ) {
306
306
res . setHeader ( key , response . headers [ key ] ) ;
307
307
} ) ;
308
308
res . writeHead ( response . statusCode ) ;
@@ -438,23 +438,23 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
438
438
// * `x-forwarded-port`: Port of the original request.
439
439
//
440
440
if ( this . enable . xforward && req . connection ) {
441
- if ( req . headers [ 'x-forwarded-for' ] ) {
441
+ if ( req . headers [ 'x-forwarded-for' ] ) {
442
442
var addressToAppend = "," + req . connection . remoteAddress || socket . remoteAddress ;
443
443
req . headers [ 'x-forwarded-for' ] += addressToAppend ;
444
444
}
445
445
else {
446
446
req . headers [ 'x-forwarded-for' ] = req . connection . remoteAddress || socket . remoteAddress ;
447
447
}
448
448
449
- if ( req . headers [ 'x-forwarded-port' ] ) {
449
+ if ( req . headers [ 'x-forwarded-port' ] ) {
450
450
var portToAppend = "," + req . connection . remotePort || socket . remotePort ;
451
451
req . headers [ 'x-forwarded-port' ] += portToAppend ;
452
452
}
453
453
else {
454
454
req . headers [ 'x-forwarded-port' ] = req . connection . remotePort || socket . remotePort ;
455
455
}
456
456
457
- if ( req . headers [ 'x-forwarded-proto' ] ) {
457
+ if ( req . headers [ 'x-forwarded-proto' ] ) {
458
458
var protoToAppend = "," + ( req . connection . pair ? 'wss' : 'ws' ) ;
459
459
req . headers [ 'x-forwarded-proto' ] += protoToAppend ;
460
460
}
@@ -577,7 +577,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
577
577
// If the incoming `proxySocket` socket closes, then
578
578
// detach all event listeners.
579
579
//
580
- listeners . onIncomingClose = function ( ) {
580
+ listeners . onIncomingClose = function ( ) {
581
581
reverseProxy . incoming . socket . destroy ( ) ;
582
582
detach ( ) ;
583
583
@@ -589,7 +589,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
589
589
// If the `reverseProxy` socket closes, then detach all
590
590
// event listeners.
591
591
//
592
- listeners . onOutgoingClose = function ( ) {
592
+ listeners . onOutgoingClose = function ( ) {
593
593
proxySocket . destroy ( ) ;
594
594
detach ( ) ;
595
595
}
0 commit comments