Add X-Forwarded-For HTTP Header

Add this code to the top of wp-config.php below <?php to show the browsers real IP in the backend of WordPress, such as Akismet or CleanTalk when using a proxy such as CloudFlare or a WAF.

// add X-Forwarded-For headers for browsers real IP Address
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
// End X-Forwarded-For HTTP Header

CISSP CISM PMP