@@ -619,7 +619,7 @@ class Request extends Readable {
619619 if ( this . remote_ip ) return this . remote_ip
620620
621621 if ( this . app_options . get ( 'trust_proxy' ) ) {
622- const xForwardedFor = this . get ( 'x-forwarded-for' )
622+ const xForwardedFor = this . headers . get ( 'x-forwarded-for' )
623623 if ( xForwardedFor ) return ( this . remote_ip = xForwardedFor . split ( ',' ) [ 0 ] )
624624 }
625625
@@ -635,7 +635,7 @@ class Request extends Readable {
635635 if ( this . remote_proxy_ip ) return this . remote_proxy_ip
636636
637637 if ( this . app_options . get ( 'trust_proxy' ) ) {
638- const xForwardedFor = this . get ( 'x-forwarded-for' )
638+ const xForwardedFor = this . headers . get ( 'x-forwarded-for' )
639639 if ( xForwardedFor && xForwardedFor . indexOf ( ',' ) !== - 1 ) return ( this . remote_proxy_ip = xForwardedFor . split ( ',' ) [ 1 ] )
640640 }
641641
@@ -685,7 +685,7 @@ class Request extends Readable {
685685 get protocol ( ) {
686686 // Resolves x-forwarded-proto header if trust proxy is enabled
687687 const trustProxy = this . app_options . get ( 'trust_proxy' )
688- const xForwardedProto = this . get ( 'x-forwarded-proto' )
688+ const xForwardedProto = this . headers . get ( 'x-forwarded-proto' )
689689 if ( trustProxy && xForwardedProto ) return xForwardedProto . indexOf ( ',' ) !== - 1 ? xForwardedProto . split ( ',' ) [ 0 ] : xForwardedProto
690690
691691 // Use uWS initially defined protocol
@@ -705,24 +705,22 @@ class Request extends Readable {
705705 * @returns {Array }
706706 */
707707 get ips ( ) {
708- const clientIP = this . ip
709- const proxyIP = this . proxy_ip
710708 const trustProxy = this . app_options . get ( 'trust_proxy' )
711- const xForwardedFor = this . get ( 'x-forwarded-for' )
709+ const xForwardedFor = this . headers . get ( 'x-forwarded-for' )
712710 if ( trustProxy && xForwardedFor ) return xForwardedFor . split ( ',' )
713711
714- return [ clientIP , proxyIP ]
712+ return [ this . ip , this . proxy_ip ]
715713 }
716714
717715 /**
718716 * ExpressJS: Parse the "Host" header field to a hostname.
719717 */
720718 get hostname ( ) {
721719 const trustProxy = this . app_options . get ( 'trust_proxy' )
722- let host = this . get ( 'x-forwarded-host' )
720+ let host = this . headers . get ( 'x-forwarded-host' )
723721
724722 if ( ! host || ! trustProxy ) {
725- host = this . get ( 'host' )
723+ host = this . headers . get ( 'host' )
726724 } else if ( host . indexOf ( ',' ) !== - 1 ) {
727725 // Note: X-Forwarded-Host is normally only ever a
728726 // single value, but this is to be safe.
0 commit comments