Plugin for getting information from ip2location database and pass it to request headers
To configure this plugin you should add its configuration to the Traefik dynamic configuration as explained here. The following snippet shows how to configure this plugin with the File provider in TOML and YAML:
Static:
experimental:pilot:token: xxxplugins:ip2location:modulename: github.com/negasus/traefik-plugin-ip2locationversion: v0.1.0
Dynamic:
http:middlewares:my-plugin:plugin:ip2location:filename: /path/to/database.binfromHeader: X-User-IP # optionaldisableErrorHeader: falseheaders:CountryShort: X-GEO-CountryShortCountryLong: X-GEO-CountryLongRegion: X-GEO-RegionCity: X-GEO-CityIsp: X-GEO-IspLatitude: X-GEO-LatitudeLongitude: X-GEO-LongitudeDomain: X-GEO-DomainZipcode: X-GEO-ZipcodeTimezone: X-GEO-TimezoneNetspeed: X-GEO-NetspeedIddcode: X-GEO-IddcodeAreacode: X-GEO-AreacodeWeatherstationcode: X-GEO-WeatherstationcodeWeatherstationname: X-GEO-WeatherstationnameMcc: X-GEO-MccMnc: X-GEO-MncMobilebrand: X-GEO-MobilebrandElevation: X-GEO-ElevationUsagetype: X-GEO-Usagetype
filename
)Required
The path to ip2location database file (in binary format)
fromHeader
)Default: empty
If defined, IP address will be obtained from this HTTP header
disableErrorHeader
)Default: false
If false
, any errors will be placed to the X-IP2LOCATION-ERROR
http header. Set to true
for disable.
headers
)Default: empty
Define the HTTP Header name if you want to pass any of the parameters
If any error occurred, this error will be placed to X-IP2LOCATION-ERROR header