[wp-trac] [WordPress Trac] #9235: Extract real IP behind a load balancer

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 3 10:21:53 UTC 2010


#9235: Extract real IP behind a load balancer
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |        Owner:         
     Type:  enhancement        |       Status:  closed 
 Priority:  normal             |    Milestone:         
Component:  Optimization       |      Version:  2.9    
 Severity:  normal             |   Resolution:  wontfix
 Keywords:  has-patch          |  
-------------------------------+--------------------------------------------

Comment(by nacin):

 Cross referencing [15560] as well as this potential snippet, good for wp-
 config.

 {{{
 if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && preg_match(
 '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $_SERVER['HTTP_X_FORWARDED_FOR']
 ) )
         $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
 }}}

 Again, specific to your environment. You also may want to check for
 HTTP_X_FORWARDED_PROTO for HTTPS.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9235#comment:40>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list