Skip to content
Docs / Install

Use Pagereckon behind Cloudflare

Cloudflare sits in front of your server as a reverse proxy, so every request passes through it first. Pagereckon still reads the access log on your own server, the origin. That works well, but two things need your attention: visitor IPs and edge caching.

This guide explains both and shows the config lines for Apache, nginx and OpenLiteSpeed.

The Pagereckon team Updated
Cloudflare at a glance, from Pagereckon

Why Cloudflare changes your access log

When Cloudflare proxies a site, your server sees the connection from a Cloudflare address, not from the visitor. So by default, the origin log records a proxy IP on every line. Cloudflare sends the real address in a request header, CF-Connecting-IP, but the web server only uses it when you tell it to.

Pagereckon reads the IP from the log line as it stands. It does not rewrite proxy addresses on its own. Without a restored IP, many people share a handful of addresses, which has three effects:

  • Pagereckon builds a visitor from a salted hash of IP and browser, so different people with the same browser can merge into one visitor.
  • Countries and cities point to the proxy's data centers, not to your readers.
  • Bursts from one address look busier than they are, which can affect bot checks.

The fix belongs on the web server, so the log itself holds the right address.

Restore visitor IPs behind Cloudflare

Cloudflare publishes its IP ranges at cloudflare.com/ips. Trust only those ranges, so nobody else can fake the header. Also, the list changes now and then, so update it from time to time.

Apache with mod_remoteip

Enable mod_remoteip, set the header, and list each published range as a trusted proxy. Then change %h to %a in your LogFormat, so the log writes the restored address.

Apache
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 173.245.48.0/20
# one RemoteIPTrustedProxy line per range from cloudflare.com/ips
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined

Nginx with the realip module

Add one set_real_ip_from line per published range and name the header. After that, $remote_addr holds the visitor IP, so the combined format logs it.

nginx
set_real_ip_from 173.245.48.0/20;
# one set_real_ip_from line per range from cloudflare.com/ips
real_ip_header CF-Connecting-IP;

OpenLiteSpeed

Set Use Client IP in Header to Trusted IP Only. Then add the published ranges to the allowed list, with a T after each one.

Finally, reload the web server and open a page from your phone. The newest log line should show your own IP, not a proxy address.

What the Cloudflare cache hides from the log

A request answered from the edge cache never reaches your server. So it never appears in the origin log, and Pagereckon cannot count it.

By default, Cloudflare does not cache HTML. It caches files by extension, such as images, CSS and JavaScript. In that default setup, page views still reach your server, while many asset requests stop at the edge. Pagereckon copes with that, because its 42-byte beacon carries a random value in the URL. Cloudflare's standard cache level treats each new query string as a new file, so the beacon still reaches your log.

However, some sites add a cache rule that caches HTML at the edge. Then repeat views of those pages stop at the edge, and your page views and bot counts come out lower. Keep that in mind when you compare numbers. Logs are still the better source than a script, as our Google Analytics alternative page explains.

Cloudflare logs and Logpush

The CDN keeps its own request logs at the edge, and Logpush can send them to storage you choose. Cloudflare's docs list Logpush on every plan, but which datasets you get depends on the products on your account.

Pagereckon does not read Logpush output. It reads the access log on your origin server. So the setup above, with restored IPs, is the one that matters for your reports.

Pick the log in Pagereckon

Nothing changes in the plugin itself. First, download the free plugin and activate it. Then open Pagereckon, Settings and press Use this log in the Find my log table. For the right path on your server, follow the nginx guide, the Apache guide or the guide for your panel.

If PHP cannot read the log, the PHP request log is a fallback. It takes the IP that PHP sees, so the IP restore above matters there too. Also, it is less complete: pages served from any page cache, including Cloudflare's, never reach PHP.

Cloudflare questions

Does Pagereckon restore Cloudflare IPs by itself?

No. It reads the IP that the web server writes to the log. Restore the real IP with mod_remoteip, the nginx realip module or the OpenLiteSpeed setting.

Do Cloudflare cached pages show up in Pagereckon?

No. A page served from the edge cache never reaches your server. By default Cloudflare does not cache HTML, so most page views still reach the log.

Does Pagereckon see AI crawlers behind Cloudflare?

Yes, when their requests reach your server. A crawler that gets a cached page at the edge, or that Cloudflare blocks, does not appear in the origin log.

Sources and references

Free plugin, optional Pro

See your own AI traffic in ten minutes

Install the free plugin, point it at your access log and read today's humans, bots and AI visits. Then add Pro when you want Search Console and the before and after reports.