Magento online customer list showing server ip address instead of remote ip address

magento online customer list error

Happy new year guys, hope you all had a nice christmas and new year.

Today we came across the problem where online customer option in Magento admin were showing web server ip address instead of customer’s/remote ip address. After further investigation, we found that it was because the web server was behind a varnish server which caused this issue. The same issue will happen even if your webserver is behind proxy server.

Actually we could have overlooked the above issue because it doesn’t stop anything on the shop but then we found another issue, the world pay phoenix module was ending up on failure page, after further investigation we found the following line in /app/code/community/Phoenix/Worldpay/controllers/ProcessingController.php -:

$remoteAddr = $request['REMOTE_ADDR'];

if (substr($remoteAddr,0,11) != '155.136.16.') {
.......
}

It was comparing the WorldPay’s IP address to make sure that it is coming directly from WorldPay and hasn’t been tempered by anyone. Because of varnish server in place, this check was failing for sure as you know and log file was showing the following error -:

Worldpay response error: IP can't be validated as WorldPay-IP.

Anyway now we had to find the solution to resolve this issue and after digging through more in detail, we found that Magento has a solution and all we had to do is add the following piece of code in the local.xml as follows -:

<config>
  <global>
     .....
     .....
     <remote_addr_headers>
           <header1>HTTP_X_REAL_IP</header1>
	   <header2>HTTP_X_FORWARDED_FOR</header2>
           <header3>REMOTE_ADDR</header3>
     </remote_addr_headers>
  </global>

We then cleared the cache and it all worked like a charm! Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

7 thoughts on “Magento online customer list showing server ip address instead of remote ip address

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.