Skip to main content
Version: 5.7.x.x Java 8 ELS

CountryIpFilter

Experimental Filter

The filter is experimental, backward compatibility with upcoming releases is not guaranteed.

The CountryIpFilter can be used to associate a country with each request.

The country is calculated using the requests' IP-address (both IPv4 and IPv6 addresses are supported) and a provided IP-Location database. Currently only mmdb (MaxMind Database) format is supported.

Classname
ch::nevis::nevisproxy::filter::validation::CountryIpFilter
Library
libValidationFilters.so.1

Configuration

DbFile

  • Type: string
  • Usage Constraint: required
  • The path of the IP-location file. Note that currently only mmdb format is supported. The database file is downloadable here (Edition ID: "GeoLite2-Country").

Rules

  • Type: new-line separated list of strings
  • Usage Constraints: optional
  • Syntax: <country>:<action>
  • Defines what action should be taken when the request is from the specified country. The allowed values can be found in the next chapter.

DefaultAction

  • Type: enum
  • Usage Constraints: optional
  • Default: allow
  • Defines what action to execute when no rules were matched because either the request's country was not in the Rules list or the request's IP-address does not have an associated country. The allowed values can be found in the next chapter.

SetEnv

  • Type: boolean
  • Usage Constraints: optional
  • Default: false
  • When enabled the determined location can be accessed from LuaFilter using req:getAttribute('geolocation').

Actions

The following values are supported:

  • allow: Allows requests from the specified country.
  • log: Creates a log entry for each request from the specified country.
  • block: Blocks requests from the specified country.