How to show real visitor’s IP address after installing CloudFlare protection while running Apache web server on Debian 7 or Debian 8

Well it’s fairly self explanatory – you are running any service that needs customer’s real IP address and now you have a problem – it shows only the proxy address of CloudFlare, this is especially painful when you do for example access restrictions (IP restrictions) via .htaccess file.

So how to fix this on Debian 7?

Btw. the # means you need to be root just fyi…

1) Check for dependencies:

# apt-get install libtool apache2-threaded-dev

2) wget the necessary files:

# wget

(Just in case the above file gets removed here is mirror – though you should use the above link in most cases.)

3) run the code:

# apxs2 -a -i -c mod_cloudflare.c

4) restart Apache service:

/etc/init.d/apache2 restart

5) Profit! 🙂

And for Debian 8 it’s quite similar:

Btw. the # means you need to be root just fyi…

1/ dependencies installation or check:

# apt-get install libtool apache2-dev

2/ wget the files (or use the mirror above)

# wget

3/ run the downloaded code:

# apxs -a -i -c mod_cloudflare.c

4/ restart Apache service:

/etc/init.d/apache2 restart

5/ Profit! 🙂

Source CloudFlare resources – btw. guys it’s awfully difficult to copy/paste from your guides to terminal window 🙁