World is now on Opti ID! Learn more

henriknystrom
Jun 18, 2018
  1396
(0 votes)

Geolocation provider changes

For quite some time Episerver CMS has come with built-in Geolocation support for MaxMind’s GeoLite database. When creating a site using the Episerver CMS Visual Studio Extension or the EPiServer.CMS NuGet package it would come with a recent version of this database included.

But as of late, MaxMind has announced that they are discontinuing the GeoLite database format effective January 2, 2019 and that the database will no longer be updated as of April 1, 2018.

As a replacement, MaxMind is instead offering the free GeoLite2 or the commercial GeoIP2 database which both comes with IPv6 support. These databases do however use a different format than the legacy GeoLite database that’s not compatible with the Geolocation provider included in the current version of Episerver CMS.

For a while, it has been possible to add support for GeoLite2 databases by replacing the built-in Geolocation provider with an excellent third-party provider available from the Episerver NuGet server, written by Khurram Khan, one of our brilliant MVPs.

With the GeoLite support officially coming to an end it no longer makes sense to continue providing the same default Geolocation support. We have therefore decided to make the following changes.

A new provider for GeoLite2 databases

A new separate NuGet package called EPiServer.Personalization.MaxMindGeolocation has been released. This package includes a Geolocation provider with support for MaxMind’s GeoLite2 database and it effectively works as a direct replacement for the provider from the PixieEPiServerExtensionMaxMindGeoIP2 package but with the added support from Episerver. This support is currently limited to usage with MaxMind’s free GeoLite2 City or Country databases, but the commercial GeoIP2 databases should also work although this has not been verified.

This provider needs to be installed separately as the EPiServer CMS package does not have a dependency to it. The Geolocation database can be downloaded from MaxMind’s website directly. To ensure that an updated list of locations is used, the provider also requires the matching CSV file which includes a list of all locations contained in the database. Make sure you specify the path of both the database and the locations file in your configuration such as:

<geolocation defaultProvider="maxmind2">
    <providers>
        <add name="maxmind2" 
             type="EPiServer.Personalization.MaxMindGeolocationProvider, EPiServer.Personalization.MaxMindGeolocation" 
             databaseFileName="path\to\GeoLite2-City.mmdb" 
             locationsFileName="path\to\GeoLite2-City-Locations-en.csv" />
    </providers>
</geolocation>

The paths can be either relative to the website root or absolute.

You can alternatively configure the provider in the ConfigureContainer method of an initialization module that implements IConfigurableModule.

public void ConfigureContainer(ServiceConfigurationContext context)
{
    context.Services.AddMaxMindGeolocationProvider("path\to\geolite2-country.mmdb", "path\to\geolite2-country-locations-en.csv");
}

Note that the names of some regions have changed compared to the old GeoLite database, so if you are using the Geographic Location Visitor Group Criterion down to this level, you may have to update these with the new names.

Use geolocation provided by the CDN

We have also added support for retrieving Geolocation from the current request when provided from the CDN in the form of a header with a country code. Due to its nature, it's limited to Continent and Country location and will only be used for sites that don't have a Geolocation provider configured. This support will be turned on by default for all DXC customers. See Content Delivery Network (CDN) Configuration for additional information on how to enable this option.

Phasing out the old GeoLite provider

The old Geolocation provider currently included in the EPiServer.ApplicationModules assembly inside the EPiServer.Framework package will be obsoleted immediately and removed in a future major release. The EPiServer.CMS package will still contain the legacy GeoLite database for a while longer as removing it would remove it from existing solutions when updating the NuGet package. Once the provider has been fully deprecated, we will remove the database as well.

New sites created using the Episerver CMS Visual Studio Extension will be configured without a Geolocation provider going forward.

If you have any questions in relation to these changes, please comment below or send your question to our support team.

Jun 18, 2018

Comments

Please login to comment.
Latest blogs
Make Global Assets Site- and Language-Aware at Indexing Time

I had a support case the other day with a question around search on global assets on a multisite. This is the result of that investigation. This co...

dada | Jun 26, 2025

The remote server returned an error: (400) Bad Request – when configuring Azure Storage for an older Optimizely CMS site

How to fix a strange issue that occurred when I moved editor-uploaded files for some old Optimizely CMS 11 solutions to Azure Storage.

Tomas Hensrud Gulla | Jun 26, 2025 |

Enable Opal AI for your Optimizely products

Learn how to enable Opal AI, and meet your infinite workforce.

Tomas Hensrud Gulla | Jun 25, 2025 |

Deploying to Optimizely Frontend Hosting: A Practical Guide

Optimizely Frontend Hosting is a cloud-based solution for deploying headless frontend applications - currently supporting only Next.js projects. It...

Szymon Uryga | Jun 25, 2025

World on Opti ID

We're excited to announce that world.optimizely.com is now integrated with Opti ID! What does this mean for you? New Users:  You can now log in wit...

Patrick Lam | Jun 22, 2025

Avoid Scandinavian Letters in File Names in Optimizely CMS

Discover how Scandinavian letters in file names can break media in Optimizely CMS—and learn a simple code fix to automatically sanitize uploads for...

Henning Sjørbotten | Jun 19, 2025 |