Why do my server logs show Cloudflare's IPs using Cloudflare?

When a site is proxied through Cloudflare, your origin web server access log records a Cloudflare IP address for each incoming request by default.  However with the mod_cloudflare tool, you can record the real IP address of incoming requests.


When your website traffic is routed through the Cloudflare network, we act as a reverse proxy. This allows Cloudflare to speed up page load time by routing packets more efficiently and caching static resources (images, JavaScript, CSS, etc.). As a result, when responding to requests and logging them your origin web server sees Cloudflare IP addresses by default.

Cloudflare reports the actual visitor IP address in an appended HTTP header called CF-Connecting-IP. However at times when you have other applications that depend on the incoming IP address of the original visitor, certain problems might arise.

To address this issue, you can log real visitor IPs with mod_cloudflare in your origin web server.  

The diagram below outlines the different ways that IP addresses are handled with and without Cloudflare.  Also, consult these articles for restoring original visitor IPs in specific web servers and CMS platforms.


Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk