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, and

But none of them worked for me.

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

  • Are you able to get the right X-Forwarded-For IP address on the server? – Jarmo Jarvi Jan 31 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 – arun tiwari Jan 31 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. – Jarmo Jarvi Jan 31 at 18:36
  • Are you using ARR to handle the load balancing, or is this in Azure? – Dylan Young Jan 31 at 18:52
  • Sorry right now I don't have any information about Load Balancer but I'll find out. – arun tiwari Feb 1 at 2:49

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.

  • 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? – arun tiwari Jan 31 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. – Radical Dave Feb 1 at 16:06
  • OK, Next I'll do the same and update here what was the issue. Thank you very much :). – arun tiwari Feb 2 at 4:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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