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

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 10 16:03:43 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       |   Resolution:             
 Keywords:  has-patch    |  
Comment (by Otto42):

 To be fair, if you're behind a proxy, then you have no reason to not use
 the HTTP_X_FORWARDED_FOR, as the REMOTE_ADDR is *always* going to be the
 address of the proxy.

 hovenko also brings up the valid point that andy's example code doesn't
 work for cases where you have multiple proxy servers.

 This is a decent approach, using a single function to standardize the
 calls to get the remote IP address, and he also even adds a filter to the
 result in case you want to roll a different approach in a plugin.

 I'd give it a +1.

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

More information about the wp-trac mailing list