WP_FAIL2BAN_EX_GEOLOCATION

Choose how country codes are resolved.

Default setting: not set

Premium flavour only


Selects the geolocation method used for country blocking and for the ISO country code stored with Premium events.

Allowed values:

  • maxmind-only — MaxMind GeoIP2 (default)

  • cloudflare-only — Cloudflare CF-IPCountry header

  • maxmind-cloudflare — MaxMind, falling back to Cloudflare

  • disabled — do not resolve country codes

The Cloudflare methods require WP_FAIL2BAN_EX_PROXY_CLOUDFLARE. The CF-IPCountry header is used only when the connecting address is in the Cloudflare IP list. Without that connecting-address check, any client that can reach WordPress could supply its own country header and change both country blocking and the country stored with Premium events.

Example: Use Cloudflare country headers only
define('WP_FAIL2BAN_EX_GEOLOCATION', 'cloudflare-only');

Country blocking and the Premium event store use the resulting ISO code. When no country can be resolved, WP_FAIL2BAN_EX_GEOLOCATION_FAIL controls whether the request is allowed or denied.

History

Changed in version 6.3.0: Cloudflare methods require Trust Cloudflare; the country header is used only from a Cloudflare connecting address.

Added in version 6.0.0.