Based on mod_remoteip.c, this Apache extension will replace the remote_ip variable in user’s logs with the correct remote IP sent from CloudFlare. The module only performs the IP substitution for requests originating from CloudFlare IPs by default.

In addition to this, the extension will also set the HTTPS environment variable to “on” in cases where Flexible SSL is in use. This prevents software such as WordPress from being broken by Flexible SSL.

Install mod-cloudflare:

yum install libtool git -y
git clone
cd mod_cloudflare
/usr/local/apache/bin/apxs -a -i -c mod_cloudflare.c

Confirm that mod_cloudflare has been installed:

service httpd restart && /usr/local/apache/bin/httpd -M|grep cloudflare

* If you get output of cloudflare listed this means that the module has been installed.