1

In a project, I have implemented Sitecore GEOIP to get visitor's country information. In local, it was working fine but when we deployed it in Production environment, GEOIP was not able to get visitor's IP because it works under load balancer. So it returns load balancer IP instead of actual visitor's IP. I tried some suggestions like in the link, http://www.bugdebugzone.com/2013/09/get-users-ip-address-in-load-balancing.html and

http://sitecoreart.martinrayenglish.com/2015/08/setting-up-sitecores-geolocation-lookup.html

But none of them worked for me.

So can anyone please suggest some solution to fix this issue?

7
  • Are you able to get the right X-Forwarded-For IP address on the server? Jan 31 '18 at 16:33
  • No, when I tried Response.Write(" || HTTP_X_FORWARDED_FOR" + Request.ServerVariables["HTTP_X_FORWARDED_FOR"]); its returning blank and when i tried <setting name="Analytics.ForwardedRequestHttpHeader" value="X-Forwarded-For" /> in Sitecore.Analytics.Tracking.config its returning Load Balancer ip itself Jan 31 '18 at 16:44
  • 2
    This means that the issue is with the Load Balancer, not with Sitecore. Since you're not getting back the IP. Unless the Load Balancer is adding the IP to the request, there's nothing Sitecore can do. Jan 31 '18 at 18:36
  • Are you using ARR to handle the load balancing, or is this in Azure? Jan 31 '18 at 18:52
  • Sorry right now I don't have any information about Load Balancer but I'll find out. Feb 1 '18 at 2:49
2

For most load balancers it is indeed the following case sensitive setting:

<setting name="Analytics.ForwardedRequestHttpHeader" value="X-Forwarded-For" />

However, you may want to check with your particular load balancer as sometimes they vary.

3
  • Thanks for your valuable suggestions. Currently I have passed value in above format itself so now should I try all with capitals letters or something else? Jan 31 '18 at 17:01
  • Hi Arun, if that format didn't work, then my next step would be to find out exactly what your load balancer is, what software it is running and see what that particular load balancer is wanting. Feb 1 '18 at 16:06
  • OK, Next I'll do the same and update here what was the issue. Thank you very much :). Feb 2 '18 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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