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.

Legacy geolocation dataset Learn more...

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.