WordPress didn’t make use of the X-Forwarded-For header in my case, so votes/comments were logged with the local IP instead the remote IP. The header field REMOTE_ADDR was set to the local IP of the webserver node behind the reverse proxy.
To get the real remote address of the calling client, you can simply add the following piece of code at the top of wp-config.php:// ** bw 2012-08-12 wordpress reverse proxy x-forwarded-for ip fix ** // if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $xffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $xffaddrs[0]; }
0 Comments