@@ -180,41 +180,6 @@ function getProto(req) {
180
180
//
181
181
RoutingProxy . prototype . proxyRequest = function ( req , res , options ) {
182
182
options = options || { } ;
183
-
184
- //
185
- // Add common proxy headers to the request so that they can
186
- // be availible to the proxy target server. If the proxy is
187
- // part of proxy chain it will append the address:
188
- //
189
- // * `x-forwarded-for`: IP Address of the original request
190
- // * `x-forwarded-proto`: Protocol of the original request
191
- // * `x-forwarded-port`: Port of the original request.
192
- //
193
- if ( this . enable . xforward && req . connection && req . socket ) {
194
- if ( req . headers [ 'x-forwarded-for' ] ) {
195
- var addressToAppend = "," + req . connection . remoteAddress || req . socket . remoteAddress ;
196
- req . headers [ 'x-forwarded-for' ] += addressToAppend ;
197
- }
198
- else {
199
- req . headers [ 'x-forwarded-for' ] = req . connection . remoteAddress || req . socket . remoteAddress ;
200
- }
201
-
202
- if ( req . headers [ 'x-forwarded-port' ] ) {
203
- var portToAppend = "," + req . connection . remotePort || req . socket . remotePort ;
204
- req . headers [ 'x-forwarded-port' ] += portToAppend ;
205
- }
206
- else {
207
- req . headers [ 'x-forwarded-port' ] = req . connection . remotePort || req . socket . remotePort ;
208
- }
209
-
210
- if ( req . headers [ 'x-forwarded-proto' ] ) {
211
- var protoToAppend = "," + getProto ( req ) ;
212
- req . headers [ 'x-forwarded-proto' ] += protoToAppend ;
213
- }
214
- else {
215
- req . headers [ 'x-forwarded-proto' ] = getProto ( req ) ;
216
- }
217
- }
218
183
var location ;
219
184
220
185
//
@@ -286,40 +251,6 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
286
251
RoutingProxy . prototype . proxyWebSocketRequest = function ( req , socket , head , options ) {
287
252
options = options || { } ;
288
253
289
- //
290
- // Add common proxy headers to the request so that they can
291
- // be availible to the proxy target server. If the proxy is
292
- // part of proxy chain it will append the address:
293
- //
294
- // * `x-forwarded-for`: IP Address of the original request
295
- // * `x-forwarded-proto`: Protocol of the original request
296
- // * `x-forwarded-port`: Port of the original request.
297
- //
298
- if ( this . enable . xforward && req . connection && req . socket ) {
299
- if ( req . headers [ 'x-forwarded-for' ] ) {
300
- var addressToAppend = "," + req . connection . remoteAddress || req . socket . remoteAddress ;
301
- req . headers [ 'x-forwarded-for' ] += addressToAppend ;
302
- }
303
- else {
304
- req . headers [ 'x-forwarded-for' ] = req . connection . remoteAddress || req . socket . remoteAddress ;
305
- }
306
-
307
- if ( req . headers [ 'x-forwarded-port' ] ) {
308
- var portToAppend = "," + req . connection . remotePort || req . socket . remotePort ;
309
- req . headers [ 'x-forwarded-port' ] += portToAppend ;
310
- }
311
- else {
312
- req . headers [ 'x-forwarded-port' ] = req . connection . remotePort || req . socket . remotePort ;
313
- }
314
-
315
- if ( req . headers [ 'x-forwarded-proto' ] ) {
316
- var protoToAppend = "," + getProto ( req ) ;
317
- req . headers [ 'x-forwarded-proto' ] += protoToAppend ;
318
- }
319
- else {
320
- req . headers [ 'x-forwarded-proto' ] = getProto ( req ) ;
321
- }
322
- }
323
254
var location ,
324
255
proxy ,
325
256
key ;
0 commit comments