We are using Sitecore 7.2 in our project. We have a requirement that based on country Geo-IP home page needs to be redirected. Please help me in achieving this functionality in local instance.


4 Answers 4


We are usually faking local IP address in this case.

We use querystring such as "?ipaddress={Fake_Ip_goes_here}" to inject faked ip address.

In your code, in place where you determine IP address, just add another condition if this query string is present, use value provided instead.

There are sites like this one https://www.nirsoft.net/countryip/ which will help you get proper IP for particular country to test whether redirection is working as expected.

Of course on production environment this is not desired so we usually introduce some kind of setting "EnableSettingIpAddressFromQueryString" which is on production set to False and we add another condition to upper one whether this setting is true so we only enable setting IP address from query string on non-production servers.

  • 3
    I can't remember in which version it was added but I usually use setting "Analytics.ForwardedRequestHttpHeader".
    – josedbaez
    Commented Jan 22, 2019 at 12:22

You can add a processor to change request IP address locally in the analytics "createVisit" pipeline.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="Sitecore.Foundation.Geolocation.Pipelines.Testing.ChangeIP, Sitecore.Foundation.Geolocation"
                   patch:after="processor[@type='Sitecore.Analytics.Pipelines.CreateVisits.XForwardedFor, Sitecore.Analytics']">
      <setting name="Foundation.Geolocation.Testing.IP" value=""/>

namespace Sitecore.Foundation.Geolocation.Pipelines.Testing
  public class ChangeIP : CreateVisitProcessor
    public override void Process(CreateVisitArgs args)
        Assert.ArgumentNotNull((object)args, "args");

        string ip = new IPAddress(Tracker.Current.Interaction.Ip).ToString();
        if (ip != "" && ip != "")

        IPAddress address;
        if (IPAddress.TryParse(Configuration.Settings.GetSetting("Foundation.Geolocation.Testing.IP"), out address))
            args.Interaction.Ip = address.GetAddressBytes();

One way I've done this before is to use ngrok http tunneling https://ngrok.com, and then use a VPN service to imitate the connection. This way works for all web applications, not just sitecore. I think this is a great way for non technical people (eg stakeholders) to test the functionality without mucking around with anything.


One of the easiest way to fake the local IP is by using the chrome plugin "Sitecore Analytics Testing Tools".


Here you can add different profiles and use accordingly.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.