Documentation Home

Geolocation Configuration

Out of the box, Broadleaf Commerce provides two implementations of the geolocation API: FreeGeoIP and MaxMind GeoIP.

To enable one of the implementations, you will need to set the following system properties. This can be done via your project's common-shared.properties file or through the System Properties section of the admin interface.

Property Description Default
geolocation.api Component name of geolocation implementation, out of box options are: blFreeGeoIpAPI, blMaxMindDBCityAPI, blMaxMindDBCountryAPI, blMaxMindPrecisionInsightsAPI, blMaxMindPrecisionCityAPI, and blMaxMindPrecisionCountryAPI blFreeGeoIpAPI
geolocation.api.enabled Enables the Broadleaf Commerce geolocation service false

Please note that if you wish to use one of these implementations, you must include the relevant broadleaf-free-geo-ip or broadleaf-max-mind-geo dependencies in your project. If you choose to use one of the the MaxMind GeoIP implementations, then you will need to complete some additional configuration. The documentation for this configuration can be found at the MaxMindGeo module installation docs.

For more details on either of the geolocation implementations, please refer to the MaxMindGeo module docs and FreeGeoIP module docs pages.

Additional Steps for Non-Spring Boot Projects

Add the blGeolocationFilter to the blPostSecurityFilterChain in your site-side applicationContext-filter.xml:

<bean id="blPostSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map request-matcher="ant">
        <sec:filter-chain pattern="/**" filters="
           ...,
           blGeolocationFilter,
           ..."/>
    </sec:filter-chain-map>
</bean>

Note: If you have a Spring Boot based project, then this step is not necessary. In that case, the filter will be automatically ordered according to its org.springframework.core.Ordered#getOrder() return value, when the resource is registered with Spring.