BoxLang 🚀 A New JVM Dynamic Language Learn More...
Using who.is IP lookup for extended geolocation data.
The IP Geolocation APIs extension provides:
It reads geolocation data from two sources:
Install the extension with:
box install preside-ext-ip-geolocation-apis
Once installed, users will immediately be able to build rules engine conditions using the "Visitor location" group of expressions.
These apply only to "web request" based conditions - they will not work in email content, for example.
The extension gets uses the https://ipwhois.io/ API to perform lookup calls to get extended geolocation data when not found in http headers. While you can use this API without a paid for API key, the usage is limited. Configuration of an API key can be provided in two ways:
settings.whoisIpLookup.apiKey
variables or WHOIS_IP_LOOKUP_API_KEY
environment variableThe extension uses a Cachebox cache named ipLookupCache
to cache results of IP lookups. If you wish to configure your own cache, define your own cache in your application's /config/Cachebox.cfc
file named ipLookupCache
.
By default, the system checks for Cloudflare headers in the form cf-ipcountry
, cf-iplongitude
, etc. If you wish to use different/more headers, these can be specified in the admin via System settings -> IP Geolocation API settings in the "Advanced" tab.
If developers wish to use the extension to check geo location data, they should do so via the geoLocationService
service component. Examples:
property name="geoLocationService" inject="geoLocationService";
// ...
var region = geoLocationService.getRegion();
if ( region == "England" ) {
// ...
}
// see also:
geoLocationService.getCity();
geoLocationService.getRegion();
geoLocationService.getCountryCode();
geoLocationService.getContinent();
geoLocationService.getLat();
geoLocationService.getLon();
geoLocationService.getBusinessName();
We use SemVer for versioning. For the versions available, see the tags on this repository. Project releases can also be found and installed from Forgebox
This project is licensed under the GPLv2 License - see the LICENSE.txt file for details.
The project is maintained by The Pixl8 Group. The lead developers are Niall O'Doherty and Dominic Watson.
We are a small, friendly and professional community. For the eradication of doubt, we publish a simple code of conduct and expect all contributors, users and passers-by to observe it.
Overhaul of the system:
test_ip_address
$
box install preside-ext-ip-geolocation-apis