Geolocation
Fastly provides a variety of geolocation data, allowing the originating geographical location of a request to be determined.
IMPORTANT: IP geolocation information, including data streamed by our log streaming service, is intended to be used only in connection with your Fastly services. Use of geolocation data for other purposes may require permission from Digital Element, our data supplier. For more information see our overview of using IP-based geolocation and intelligence.
The client.geo.
namespace contains the geolocation data we recommend for most use cases. The client.as.
namespace offers information about the client's Autonomous System (AS), which is often the end user's Internet Service Provider.
IP address used for lookup
The IP address used for the geolocation lookup is automatically populated from client.ip
by default, but may be overridden explicitly by setting client.geo.ip_override
.
Lossy formats
Geographic variables representing names are available in several formats. Note in particular the *.ascii
variables are lossy. These variables have diacritics removed and are normalized to lower case spellings. These *.ascii
variables are intended for ease of use as a symbolic string in code (for example, to perform some different action depending on the city name), and are generally inappropriate for presenting to users due to their simplified content.
Absent data
The data is updated periodically, as IP allocations change and various amendments are made. Some variables may be absent for the current data at any given time.
For STRING types, the special value ?
is used to indicate absent data. These may be normalized to VCL empty strings using the if
ternary operator:
if (client.as.name == "?", client.as.name, "");
In general values of type STRING
in VCL may be not set
, but this should never occur for the Geolocation variables.
- client.geo.area_code
- client.geo.city
- client.geo.city.ascii
- client.geo.city.latin1
- client.geo.city.utf8
- client.geo.conn_speed
- client.geo.conn_type
- client.geo.continent_code
- client.geo.country_code
- client.geo.country_code3
- client.geo.country_name
- client.geo.country_name.ascii
- client.geo.country_name.latin1
- client.geo.country_name.utf8
- client.geo.gmt_offset
- client.geo.ip_override
- client.geo.latitude
- client.geo.longitude
- client.geo.metro_code
- client.geo.postal_code
- client.geo.proxy_description
- client.geo.proxy_type
- client.geo.region
- client.geo.region.ascii
- client.geo.region.latin1
- client.geo.region.utf8
- client.geo.utc_offset