File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,9 +176,22 @@ Logger.tokens = {
176176 return Array . isArray ( header ) ? header . join ( ', ' ) : header ;
177177 } ) ,
178178
179+ realClientIp : new TokenFn ( function ( ) {
180+ if ( ! this . req ) { return ; }
181+
182+ console . log ( 'This should be the real-client-ip (might not appear locally): ' + this . req . get ( 'x-real-client-ip' ) ) ;
183+ console . log ( 'This should be forwarded-for (might not appear locally): ' + this . req . get ( 'x-forwarded-for' ) ) ;
184+ console . log ( 'This should be Host (should ALWAYS appear): ' + this . req . get ( 'host' ) ) ;
185+ console . log ( 'This should be all headers: ' + this . req . headers ) ;
186+
187+ return this . req . headers [ 'x-real-client-ip' ] ; // This is temporary because the other 2 headers don't get set when running locally
188+ } ) ,
189+
179190 clientip : new TokenFn ( function ( ) {
180191 if ( ! this . req ) { return ; }
192+ // return 'Pretend this is an IP!';
181193 return this . req . ip || ( this . req . connection && this . req . connection . remoteAddress ) ;
194+ // return this.req.headers['x-real-client-ip'];
182195 } ) ,
183196
184197 request : new TokenFn ( function ( ) {
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ Manager.defaultOptions = {
257257 } ,
258258 requestMeta : {
259259 clientip : 'clientip' ,
260+ realClientIp : 'realClientIp' ,
260261 uniqueID : 'req.x-uniq-id' ,
261262 remoteAddress : 'connection.remoteAddress' ,
262263 hostname : 'hostname' ,
You can’t perform that action at this time.
0 commit comments