Restoring Visitor IP Address while using Cloudflare Proxy DNS

So if you like me and use Cloudflare as your DNS and name server provider while also using WordPress, you’ll probably notice that the visitor IP’s are masked by the proxy service. Now I use virtualmin and webmin as my hosting manager, and there’s no built-in solution to restore visitor IP address. Here is a guide on how to easily install the required Apache modules to restore visitor IP address. This will help you build accurate website reports and get a better feel for the demographics going to your website. Another thing is that I use Ubuntu 20.1 and Apache 2.4. This is the best guide to restore visitor IP addresses that I found yet. I hope this helps.

Make sure the following is installed:

  • Red Hat/Fedora sudo yum install httpd-devel libtool git
  • Debian/Ubuntu sudo apt-get install apache2-dev libtool git

Clone the following for the most recent build of mod_cloudflare:

  • Red Hat/Fedora/Debian/Ubuntu: git clone https://github.com/cloudflare/mod_cloudflare.git; cd mod_cloudflare

Use the Apache extension tool to convert the .c file into a module:

  • Red Hat/Fedora/Debain/Ubuntu:apxs -a -i -c mod_cloudflare.c

Restart and verify the module is active:

  • Red Hat/Fedoraservice httpd restart; httpd -M|grep cloudflare
  • Debian/Ubuntu:sudo apachectl restart; apache2ctl -M|grep cloudflare

Just know that the last step didn’t work for me I had to restart Apache 2.4 manually.

Leave a Reply

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