geoIpFilter
geoIpFilter(
config?):Policy
Defined in: src/policies/traffic/geo-ip-filter.ts:43
Block or allow requests based on geographic country code.
Reads the country from the configured header (default cf-ipcountry,
set by Cloudflare). Supports allowlist and denylist modes. Country
sets are pre-computed once at construction time for efficiency.
Parameters
Section titled “Parameters”config?
Section titled “config?”Country filter rules and mode selection.
Returns
Section titled “Returns”A policy at priority 1 (IP_FILTER).
Example
Section titled “Example”// Allow only US, Canada, and UKgeoIpFilter({ mode: "allow", allow: ["US", "CA", "GB"] });
// Block specific countriesgeoIpFilter({ deny: ["CN", "RU"] });