[wp-trac] [WordPress Trac] #4602: Function for getting the clients IP address

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 9 16:53:21 GMT 2007


#4602: Function for getting the clients IP address
-------------------------+--------------------------------------------------
 Reporter:  hovenko      |       Owner:  anonymous  
     Type:  enhancement  |      Status:  new        
 Priority:  normal       |   Milestone:  2.3 (trunk)
Component:  General      |     Version:             
 Severity:  normal       |    Keywords:             
-------------------------+--------------------------------------------------
 WordPress misses a function to get the IP address of the original client.
 It is critical to have a function like this when using plugins for voting,
 users online and when posting comments when WordPress runs on a server
 behind an HTTP proxy such as Varnish.

 It checks if the header X-Forwarded-For is set (available from
 {{{$_SERVER['HTTP_X_FORWARDED_FOR'])}}} and uses the first address in this
 list. If it's not set, it uses {{{$_SERVER['REMOTE_ADDR']}}} instead.

 The function also applies a filter called "remote_ip_address" before
 returning the address.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4602>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list