proxied web server
-
Our university web server is behind a group of proxy computers. Using PHP,
when one issues “$_SERVER[‘REMOTE_ADDR’]” it returns the IP address of the proxy, not the “real” IP of the computer visiting our sites.Today, Googlebot was searching our sites, and it triggered Login Security Solution and send me an email. It provided the offending IP address as that of the proxy.
BUT, the “real” address is stored in the http headers, so issuing:
$rgheaders = getallheaders();
followed by
$ip = rgheaders[‘X-Forwarded-For’];
gets the true remote address.In an attempt to accommodate this in Login Security Solution, I edited login-security-solution.php to modify get_ip() to this:
protected function get_ip() { if (empty($_SERVER['REMOTE_ADDR'])) { return ''; } $rgheaders = getallheaders(); /* return $this->normalize_ip($_SERVER['REMOTE_ADDR']); */ return $this->normalize_ip($rgheaders['X-Forwarded-For']); }Do you think this will work? Do I have to make changes in other PHP files?
Thanks for a great plugin,
rick
—
Richard Gray, Ph.D.
Center for Learning and Memory
The University of Texas at Austin
[email protected]
The topic ‘proxied web server’ is closed to new replies.