We have a site running 7.0.2.5 SP1 (yes...still) which is load-balanced across two servers behind an ACE load-balancer. The way the load-balancer is set up, we do not get real IP addresses sent in the REMOTE_ADDR header, we get it as HTTP_X_FORWARD. I've added this method to CommonLogic:
C#/VB.NET Code:
public static string GetIP()
{
String ret = String.Empty;
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARD"] != null)
{
ret = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARD"];
}
else
{
ret = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
return ret;
}
I have replaced calls for CommonLogic.ServerVariables("REMOTE_ADDR") with CommonLogic.GetIP() throughout the code, yet I still see the LastIPAddress in the Customer table set as the IP Address of our router. Is there something in the code that you do not provide source access to that is still using CommonLogic.ServerVariables("REMOTE_ADDR")? If so, is there a way for me to override the method that is doing it?