This article covers a Bloomreach Experience Manager version 13. There's an updated version available that covers our most recent release.

Custom Resolution of Client's Originating IP Address

Introduction

Goal

Configure the HTTP header(s) to read the client's originating IP address from.

Background

Sometimes both the delivery tier and authoring tier need to recognize the client's originating IP address for various reasons. For example, you might want to enable HST Page Diagnostics or CMS Diagnostics only when accessed by some clients with specific IP addresses. Or you might want to use the GeoIPCollector in Relevance Module so that the visitors may get personalized pages based on where they come from.

By default, Bloomreach Experience Manager reads X-Forwarded-For HTTP header or falls back to javax.servlet.ServletRequest#getRemoteAddr() if the hearder isn't available. This is a resonable default configuration for most environments.

However, sometimes you need to use a different HTTP headers when the loadbalancer or HTTP servers in your environment provide a different HTTP header other than X-Forwarded-For.

Bloomreach Experience Manager provides a flexibly way to configure which HTTP header(s) to use in clients' originating IP addresses, in $CATALINA_BASE/conf/context.xml file.

Configuration for HTTP 'Forwarded For' Header

Suppose you can get the client's originating IP address from X-FOO-Forwarded-For HTTP header instead, as an example, in your environment. Then you should add the http-forwarded-for-header parameter in $CATALINA_BASE/conf/context.xml like the following example:

<?xml version='1.0' encoding='utf-8'?>
<Context>

    <!-- SNIP -->

    <Parameter name="http-forwarded-for-header" value="X-FOO-Forwarded-For" override="false" />

    <!-- SNIP -->

</Context>

That's it. With the configuration, both delivery tier and authoring tier and GeoIPCollector in Relevance Module will start recognizing the clients' originating IP addresses by looking up the specificed HTTP header.

Tip: Since Bloomreach Experience Manager v12.2, if needed, you can also specify a comma separated multiple header names in the http-forwarded-for-header parameter. e.g, "X-FOO-Forwarded-For, X-Forwarded-For". If multiple header names are set in the parameter, it will read the first available HTTP header to recognize the clients' originating IP addresses. Sometimes this multiplicity support is useful when you deploy applications onto multiple different environments. e.g, Acceptance environment only with Apache HTTP Server and Production environment with an external load balancer as well as an internal Apache HTTP Server.
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?