• Resolved drnick2

    (@drnick2)


    Out of the blue starting 3/1/2019 all orders received are displaying my host servers IP address and not the customers. No changes or plugins were added to Woocommerce from the previous day when it displayed the proper IP to the following day when it did not. I have been using Woocommerce for several years without this ever happening, any help would be appreciated.

Viewing 15 replies - 1 through 15 (of 48 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    Just to make sure: Have you spoken with your hosting provider about that? Also, would you mind sharing a copy of your system status report as found under WooCommerce > System Status?

    Thanks!

    Thread Starter drnick2

    (@drnick2)

    I received a reply back just now and below is the response from Hostgator.

    We have added a directive to the wp-config that should allow the correct IP to pass through. Though we do not support the functionality of Woo Commerce directly we will be willing to help where we can. The best course of action if this directive is not working is to contact Woo Commerce directly and as which steps need to be taken to correct this issue. If we are needed to investigate this further we will need replication steps to see how and what is going wrong. Here is the change that we made.

    # diff wp-config.php wp-config.php.1552418217.bak

    // Code for showing correct client IP address
    if ( isset( $_SERVER[‘HTTP_X_FORWARDED_FOR’] ) ) {
    $mte_xffaddrs = explode( ‘,’, $_SERVER[‘HTTP_X_FORWARDED_FOR’] );
    $_SERVER[‘REMOTE_ADDR’] = $mte_xffaddrs[0];

    Let us know if there are any further issues of ir there is anything we can help with. We appreciate your patience and look forward to hearing from you.

    So now I just need to wait for a transaction to see if it works, I will post back when the results.

    Thread Starter drnick2

    (@drnick2)

    Unfortunately the above solution did not work as I still receive Hostgators IP address instead of the customers.

    Hi drnick2
    Sorry to hear that didn’t work.
    I was hoping it would since switching hosting is a pain but having the correct IP address is important for our store.

    You mentioned you have another host that the IP work correctly with.
    Are you happy with them and the performance?
    Any name you wouldn’t mind mentioning?

    Thanks for reaching out to Hostgator.

    I posted what they sent me on the other thread and was told it’s a Woocommerce issue and how it get’s handled in the script.

    Thanks

    Thread Starter drnick2

    (@drnick2)

    Hi Wooguy,
    I was hoping it would work also, as having the customer IP is very important to us as it is you. The other provider I am using is Namecheap, they are OK, unfortunately their customer service is chat or email only, NO live person which I prefer on occasions like this. I have not encountered any downtime as of yet in the couple of years being with them and any issues I had were small and taken care of via chat. Personally I would like to test site hosted on a SSD server like Inmotion Hosting and see if the speed difference when page loading is really that noticeable on a speed test. Back to Woocommerce, I hope someone from their staff takes the initiative and finds a solution.

    Hey drnick2,
    Did try NameCheap for another site when they had a sale going.

    I currently have the Business Cloud hosting from Hostgator.
    Do you have cloud or regular hosting?
    I am curious as to if this problem is across all of their packages.

    If enough users have this issue, it might draw enough attention to the problem to get some sort of fix.
    Probably quite a few have not noticed the problem that use Hostgator.

    Thread Starter drnick2

    (@drnick2)

    I have the aluminum reseller package. I will contact Hostgator again in a few days, if they do not reply back to my emails today regarding the script they added. Do you feel this is a Woocommerce or Hostgator issue?

    drnick2,
    Here is the email I was sent:

    Thank you for contacting HostGator.com. It is understood that you’ve observed the incorrect IP being displayed within the Order’s section, of Woocommerce, within the WordPress installation for ‘yoursite.com’. I’m happy to help. Upon review, I found that this issue began to occur between February 21, 2019 at 4:20 pm PST and February 22, 2019 at 8:05 am PST. During this window of a timeframe, I found that the only major change to occur was an upgrade from EasyApache 3 to EasyApache 4. Unfortunately when cPanel is updated to use EasyApache 4, it is a server-wide change, of which we do not plans of reverting.

    In an extensive review, I had attempted to identify the exact change from the upgrade, that would be preventing the customer’s IP address from being displayed, and display your cPanel IP address instead. During this review, a test was performed, to confirm that PHP is indeed reporting the correct remote IP address. This was done by creating the following file.

    [root@cloudxxxx /home/yoursite/public_html]# cat /home/yoursite/public_html/test.php
    <?php
    echo “REMOTE_ADDR: ” . $_SERVER[‘REMOTE_ADDR’];

    ?>

    After creating this file, I went ahead and accessed ‘https://yoursite.com/test.php&#8217;, in which I found that the correct IP address is being returned by PHP. You should be able to confirm this by going to the URL, on your end as well.

    The fact that the correct IP address is being returned by PHP, indicated that the issue at hand is not directly related to the server environment, but rather the way in which WooCommerce is obtaining the customer’s IP, when an order is placed. Based on reviewing the PHP code, that makes up the function to get the IP address, it appears that the script is checking for the ‘$_SERVER[‘HTTP_X_FORWARDED_FOR’, before the $_SERVER[‘REMOTE_ADDR’], which contains the visitor’s IP address you’re expecting to see. This can be seen in the following section of the plugin file ‘class-wc-geolocation.php’.

    /home/yoursite/public_html/wp-content/plugins/woocommerce/includes/class-wc-geolocation.php
    136 public static function get_ip_address() {
    137 if ( isset( $_SERVER[‘HTTP_X_REAL_IP’] ) ) { // WPCS: input var ok, CSRF ok.
    138 return sanitize_text_field( wp_unslash( $_SERVER[‘HTTP_X_REAL_IP’] ) );
    138 // WPCS: input var ok, CSRF ok.
    139 } elseif ( isset( $_SERVER[‘HTTP_X_FORWARDED_FOR’] ) ) { // WPCS: input var ok,
    139 CSRF ok.
    140 // Proxy servers can send through this header like this: X-Forwarded-For
    140 : client1, proxy1, proxy2
    141 // Make sure we always only send through the first IP in the list which
    141 should always be the client IP.
    142 return (string) rest_is_ip_address( trim( current( preg_split( ‘/,/’, sa
    142 nitize_text_field( wp_unslash( $_SERVER[‘HTTP_X_FORWARDED_FOR’] ) ) ) ) ) ); // WPCS: input var
    142 ok, CSRF ok.
    143 } elseif ( isset( $_SERVER[‘REMOTE_ADDR’] ) ) { // @codingStandardsIgnoreLine
    144 return sanitize_text_field( wp_unslash( $_SERVER[‘REMOTE_ADDR’] ) ); // 144 @codingStandardsIgnoreLine
    145 }
    146 return ”;

    According to Hostgator from what I gather “way in which WooCommerce is obtaining the customer’s IP, when an order is placed is the issue”

    • This reply was modified 5 years, 8 months ago by wooguy.
    Thread Starter drnick2

    (@drnick2)

    Interesting, thank you.

    drnick2,
    Since there have been no other comments posted with different hosts involved, I am thinking this is a Hostgator issue.
    This started for me when they updated the Apache servers in late February.

    Thread Starter drnick2

    (@drnick2)

    Wooguy,
    You are probably right, I was checking the forum this morning and found no new mentions of this problem. I am going to contact Hostgator tomorrow and see if they can continue to look into this. My issues started March 1st, but I do not know if my server was updated the same day as Feb 28th was fine.

    Thread Starter drnick2

    (@drnick2)

    I contacted Hostgator and they will continue to look into the issue at hand. I will post their findings when received.

    Thanks drnick2,
    It’s only a matter of time before more Hostgator customers notice this problem.

    I hope they take a look at this thread and figure something out other than customers having to move hosting.

    Thread Starter drnick2

    (@drnick2)

    Is there anybody else out there having the same customer IP Issue?

    I don’t know if this is directly related or not but here is an issue I am seeing on Hostgator. In Joomla, a security plugin started reporting everyone’s IP as the same. After some testing using just PHP, I found that if I connect with http then the remore_addr and the http_x_forwarded_for is the same and the client’s IP. If I connect with https, the remote_addr is the client’s IP and the http_x_forwarded_for is the web server. BTW all access logs report the correct ip addresses. Hope this helps. It seems related. Here is the code I used to test:
    <?php
    echo “REMOTE_ADDR= “;
    echo $_SERVER[‘REMOTE_ADDR’];
    echo “<br>”;
    echo “HTTP_X_FORWARDED_FOR= “;
    echo $_SERVER[‘HTTP_X_FORWARDED_FOR’];
    echo “<br>”;
    echo “HTTP_CLIENT_IP=”;
    echo $_SERVER[‘HTTP_CLIENT_IP’];
    ?>

Viewing 15 replies - 1 through 15 (of 48 total)
  • The topic ‘Same Ip Address for All Orders’ is closed to new replies.