Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 6 of 6

Thread: Load Balancing Question

  1. #1
    Ash is offline Member
    Join Date
    Sep 2007
    Posts
    55

    Default Load Balancing Question

    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?

  2. #2
    Ash is offline Member
    Join Date
    Sep 2007
    Posts
    55

    Default

    Can I get a little love here? This IP address issue is a huge pain. Everyone shows up with the same IP Address to our store so we have to keep flushing the FailedTransactions table to keep people from getting order declined messages.

  3. #3
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    The logic for customer ip tracking is located on the ASPDNSFApplication assembly, which we don't ship source with.
    What you can do is, put a hook inside CommonLogic.ServerVariables, since we also call that routine to get the remote ip.

    i.e.

    C#/VB.NET Code:
    public static String ServerVariables(String paramName)
    if(
    paramName == "REMOTE_ADDR")
    {
       return 
    CommonLogic.GetIP();
    }
    else.... 
    On another note, we've already addressed this issue on the next major release of ML.

  4. #4
    Ash is offline Member
    Join Date
    Sep 2007
    Posts
    55

    Default

    Oh jeez... I don't know why I didn't just do that.

    Quote Originally Posted by ASPDNSF Staff - Mark View Post
    On another note, we've already addressed
    this issue on the next major release of ML.
    Waiting for the powers that be to break out the checkbook and get us multi-store.

    Thanks, Mark.

  5. #5
    Ash is offline Member
    Join Date
    Sep 2007
    Posts
    55

    Default

    So, we made that change, but we're still not seeing real IP addresses in our orders table. Is there some other place I should be looking that is grabbing Request.ServerVariables["REMOTE_ADDR"] instead of CommonLogic.ServerVariables("REMOTE_ADDR")?

    I made a page that shows what the CommonLogic.ServerVariables("REMOTE_ADDR") method is returning, and it's the real IP, but nothing in the database seems to be reflecting this change.

  6. #6
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    The changes will only affect newly created orders,
    previous orders will still maintain the previous ip address logged for that customer.
    Customer ipaddress is only copied over at the point of order creation.