Apache Show Real IP Address when using CloudFlare

When using Apache web server behind cloudflare, apache logs show cloudflare IP address instead of real visitor IP address. To show actual visitor IP address, you need to install mod_cloudflare apache module.

Before you can install the module, you need to install following requirments.

On Debian/Ubuntu server,

apt-get install apache2-dev libtool git

Now install mod_cloudflare with

cd /usr/local/src
git clone https://github.com/cloudflare/mod_cloudflare.git; cd mod_cloudflare
apxs -a -i -c mod_cloudflare.c

Restart apache web server with

service apache2 restart

Verify mod_cloudflare apache module is loaded with

apachectl -M | grep cloudflare

apache cloudflare module

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *