How To Configure Your Server to Log Real Visitor IPs

Posted on by dpepper | Updated:
Category: Tutorials | Tags: cdn, Cloudflare
Reading Time: 2 minutes
Getting Started With CloudFlare™
III. How To Configure Apache to Log Real Visitor IPs

Because CloudFlare acts as a proxy, all visits to your website and web applications will, by default, be logged as originating from a CloudFlare IP address — not the visitor’s actual IP address. However, the Apache module mod_cloudflare can be used to ensure that visitors’ actual IP addresses are logged and displayed. We recommend that you activate mod_cloudflare as outlined in this article to accurately log website visitor IP addresses and prevent unwanted behavior. Without this step, your server’s firewall could block CloudFlare’s IP addresses, making your site inaccessible. If you need to check whether the module is already enabled or need assistance installing it, please open a ticket and Heroic Support® will be happy to help.

Pre-Flight Check

  • This article assumes that you have already set up CloudFlare and added your domain.
  • We’ll be installing the mod_cloudflare module for Apache, and you’ll need root-level SSH access to proceed.
  • If you’re using a web server other than Apache, you’ll need to enable the appropriate module for your web server. For Nginx, you can use the ng_http_realip_module, and an HTTP Module for IIS also is available.

Installing mod_cloudflare on CentOS 6 and CentOS 7 Servers with cPanel

To install mod_cloudflare on a cPanel server running CentOS 6 or CentOS 7, simply yum install our mod_cloudflare package: yum install lw-mod_cloudflare-cpanel We built the RPM in a way that does not require you to run EasyApache, because Heroic Support® is what we do 🙂 To confirm that the module has been added to Apache, run this command: httpd -M | grep -i cloud

Installing mod_cloudflare on Core-Managed CentOS 6 and CentOS 7

To install mod_cloudflare on a core managed (non-cPanel) server running CentOS 6 or 7, simply yum install our mod_cloudflare package! yum install lw-mod_cloudflare To confirm that the module has been added to Apache, run this command: httpd -M | grep -i cloud

Installing mod_cloudflare on Ubuntu/Debian Core-Managed Servers

To install mod_cloudflare on Ubuntu/Debian Core Managed, simply apt-get install our mod_cloudflare package: apt-get install lw-mod_cloudflare To confirm that the module has been added to Apache, run this command: httpd -M | grep -i cloud

Next Step: Get to Know CloudFlare

Now that you’ve got everything configured, it’s time to Explore the CloudFlare dashboard.

Avatar for dpepper

About the Author: dpepper

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article