Cloudflare, Sucuri and real visitor IPs

Behind Cloudflare or the Sucuri firewall, WP Feint Pro recovers visitors’ real IP address, without being fooled by a forged header, for login attempt limiting, bans and logs.

Pro feature

Included in WP Feint ProFrom €59 excl. tax / year

See Pro pricing

The problem: behind Cloudflare or Sucuri, everyone has the same address

When your site goes through Cloudflare’s proxy (the orange cloud in the DNS settings), visitors no longer connect directly to your server: a Cloudflare server does it on their behalf. Without any setting, WordPress and your plugins therefore see the IP address of a handful of Cloudflare servers instead of the visitors’ own. Yet Cloudflare does pass on the real address, in the CF-Connecting-IP HTTP header. The Sucuri firewall works the same way, with the X-Sucuri-ClientIP header (see below).

FeatureWithout proxy supportWith WP Feint Pro
Login attempt limitingFailures from many visitors add up on the same address: a bot can get legitimate visitors blocked.Each visitor is counted separately.
Bot banningBanning a proxy server’s address also hits innocent visitors.The bot’s own address is banned.
Logs (traps, activity, new device alert)Always the same proxy addresses, which tell you nothing.The visitor’s real network (truncated address).

What WP Feint Pro does

Pro reads the CF-Connecting-IP header, but only when the connection really comes from an official Cloudflare address, and only if the header contains a valid IP address and nothing else. The address the site sees is then replaced very early as WordPress loads: every WP Feint module benefits, and so does WordPress itself (the IP address saved with comments, for example).

This check is essential: anyone can send a CF-Connecting-IP header straight to your server. If it were trusted without checking where it comes from, an attacker could pose as any address, get around login attempt limiting or get someone else banned.

What’s included Pro feature

  • Cloudflare’s official IP range lists (IPv4 and IPv6), built into the plugin and updated every week from cloudflare.com. A downloaded list that is invalid or abnormally short is ignored: the previous one stays in use.
  • Three modes: Automatic (default), On and Off.
  • Diagnostics in the card: the connection address received by the server, your address as seen by the site, the CF-Connecting-IP header received, the number of ranges and the date they were last updated, and a “Cloudflare detected” badge.
  • Warnings if the header arrives from an address that isn’t Cloudflare’s, if it is invalid, if the On mode is chosen while the request doesn’t go through Cloudflare, or if the Off mode is chosen while it does.
  • An Update the ranges now button.
ModeWhen to choose it
Automatic (recommended)In almost every case. The header is used when the request really comes from Cloudflare and ignored otherwise: no risk if the site is not behind Cloudflare.
OnThe site is behind Cloudflare. Same safety check, with a warning in the card if a request doesn’t go through Cloudflare.
OffThe web server already restores the real address (see below), or you prefer the header never to be read.
WP Feint Pro “Proxy / CDN: real visitor address” card: connection address and address as seen by the site, then a Cloudflare part (Automatic mode, CF-Connecting-IP header absent, 15 IPv4 and 7 IPv6 ranges, Update the ranges now button) and a Sucuri firewall part (Automatic mode, X-Sucuri-ClientIP header absent, 5 built-in ranges)

How to set it up

  1. Go to WP Feint → Protection (the mask icon in the admin menu), “Proxy / CDN: real visitor address” card, Cloudflare part.
  2. Leave the mode on Automatic. If the site goes through Cloudflare, the “Cloudflare detected” badge appears and the “Your address as seen by the site” line shows your own address, not a Cloudflare server’s.
  3. If a warning appears, follow it: check that the proxy (orange cloud) is on in Cloudflare’s DNS settings, or, if another proxy sits in front of the site, restore the real address in the server configuration.
  4. Save the settings.

Behind the Sucuri firewall

Sucuri’s firewall (the paid service that filters traffic in the cloud, enabled by changing your DNS, not to be confused with the free Sucuri Security plugin) causes the same problem: your server sees the addresses of Sucuri’s servers, and the real address arrives in the X-Sucuri-ClientIP header. WP Feint Pro restores it with the same rule as for Cloudflare: the header is only accepted when the connection really comes from an official Sucuri firewall address range, and only if it contains a valid IP address and nothing else.

  • Same card: the “Sucuri firewall” part of the “Proxy / CDN” card shows the “Sucuri detected” badge, the X-Sucuri-ClientIP header received and the number of ranges in use.
  • Same three modes: Automatic (default, recommended), On and Off, with the same warnings as for Cloudflare.
  • Editable address ranges: Sucuri publishes no list to download. The ranges given in its documentation are built into the plugin; if Sucuri adds new ones, type the full list in the “Sucuri firewall ranges (optional)” field, one range per line: it then replaces the built-in list. Ranges that are too wide (wider than a /16 in IPv4 or a /24 in IPv6) are rejected.
  • No Sucuri Security plugin needed: the address is restored as soon as plugins load, earlier than the Sucuri plugin does it. Bans, traps, login attempt limiting and the activity log see the real visitor.

Only one proxy is taken into account per request: Cloudflare is checked first, then Sucuri. A chain of proxies (Cloudflare in front of the Sucuri firewall, an unusual setup) must be restored in the server configuration.

Even better: at the server level

If your host allows it, restore the real address directly in the web server: Apache’s mod_remoteip module with Cloudflare’s ranges, or the set_real_ip_from and real_ip_header CF-Connecting-IP directives in Nginx. Server logs and other applications benefit too. Then choose the Off mode in WP Feint.

For the Sucuri firewall, the principle is the same with the X-Sucuri-ClientIP header and Sucuri’s ranges (mod_remoteip, or real_ip_header X-Sucuri-ClientIP in Nginx), then the Off mode in the Sucuri part of the card. Sucuri also recommends blocking direct access to the origin server by only accepting its firewall’s addresses: otherwise an attacker who knows the server’s address can bypass the firewall.

Limits and precautions

  • Only the Cloudflare and Sucuri firewall headers are supported, one proxy at a time. Behind another proxy or CDN, a host’s load balancer or a chain of proxies, restore the address at the server level.
  • Sucuri’s ranges are not updated automatically, as Sucuri publishes no list: if the card reports a header coming from an unknown address, check its documentation.
  • If the weekly range update fails, the previous list, or failing that the built-in list, remains in use.
  • This feature gives the other modules the right address; it doesn’t replace Cloudflare’s firewall or its own security rules.

Frequently asked questions

What about behind the Sucuri firewall?

WP Feint Pro also restores the real address from the X-Sucuri-ClientIP header, only when the connection comes from the Sucuri firewall’s official address ranges. The setting is in the same “Proxy / CDN” card, in Automatic mode by default.

Do I need the Sucuri Security plugin for this?

No. WP Feint Pro restores the address itself, earlier than the Sucuri plugin. The plugin remains useful for its own features (audit log, file integrity, SiteCheck): see Sucuri and WP Feint.

And if the site is not behind any proxy?

In Automatic mode, nothing changes: the CF-Connecting-IP and X-Sucuri-ClientIP headers are only used when the connection comes from Cloudflare or Sucuri, and ignored otherwise. Nobody can use them to fake an address.

Start free, upgrade to Pro when you’re ready

The free version already hides WordPress, moves the login page, blocks XML-RPC and counts bots. Pro locks down logins, renames file URLs and monitors your sites for you: known vulnerabilities, core integrity, activity log, email alerts and the update status of all your sites in your member area. From €59 per year excl. tax, far less than the cleanup offers whose prices we checked. Compare the costs.

See Pro pricing

Product tour

From installation to protection, in a few minutes

Real screenshots of the WP Feint Pro admin, step by step.

  1. Install the plugin

    Plugins > Add New > Upload Plugin: choose the wp-feint-pro.zip file from your account, then click Install Now.

    Screenshot: Install the plugin
  2. Activate it

    Activate WP Feint and WP Feint Pro, then open the settings with the Settings link.

    Screenshot: Activate it
  3. Follow the checklist

    The Getting started tab shows what is done and what is left to do, one step at a time.

    Screenshot: Follow the checklist
  4. Pick a protection mode

    Essential, Recommended or Maximum: one click ticks the right choices in every tab. You can fine-tune each setting afterwards.

    Screenshot: Pick a protection mode
  5. Choose the software to imitate

    Joomla!, for example: bots then hunt for vulnerabilities your site does not have. The look of your site does not change.

    Screenshot: Choose the software to imitate
  6. Move the login page, safely

    Choose a new login address, then test it: it is enabled only once it has been proven to work, so you cannot lock yourself out.

    Screenshot: Move the login page, safely
  7. Turn on two-step verification

    Scan the QR code with an authenticator app, then enter the 6-digit code it shows. A stolen password is no longer enough.

    Screenshot: Turn on two-step verification
  8. Watch the bots fall into the traps

    Requests for /.env, /administrator/ or /phpmyadmin come from attack bots: they are counted, with the most targeted addresses.

    Screenshot: Watch the bots fall into the traps
  9. Get alerted about vulnerabilities

    Every day, your plugins, themes and WordPress are checked against a public database of known vulnerabilities, with what to do. Alerts can go by e-mail.

    Screenshot: Get alerted about vulnerabilities
  10. Activate your licence

    Your licence key unlocks the Pro features, automatic updates and the signature feed. You can check it or move it to another site at any time.

    Screenshot: Activate your licence