Magento Online Customers Showing Local IP Address 127.0.0.1

Sunday, 6. May 2012

Came across this problem where Magento’s online customers are all showing local ip address of 127.0.0.1. After a bit of investigating, the problem was due to the fact that the web server was behind a proxy server.

To get around this problem, Magento has a solution (seen on local.xml.additional file) and all you need to do is add this snippet code below to your current local.xml file inside the global tags.

<global>
    ...
	<remote_addr_headers>
            <header1>HTTP_X_REAL_IP</header1>
            <header2>HTTP_X_FORWARDED_FOR</header2>
        </remote_addr_headers>
     ...  
</global>

Remember to refresh the cache for the changes to take effect then re-visit the online customers again.

Enjoy!

Magento online customer shows 127.0.0.1 instead of real IP address

Tuesday, 10. April 2012

Came across this issue today when client mentioned after the move to new server all of a sudden all online customers IP address were showing as 127.0.0.1 instead of their correct IP address.

This is a proxy issue and the best solution lies within the local.xml.additional file.

Basically you will need this snippet text below added to you local.xml file just before the closing of the tag

   ...
   <remote_addr_headers>
       <header1>HTTP_X_REAL_IP</header1>
       <header2>HTTP_X_FORWARDED_FOR</header2>
   </remote_addr_headers>
   ...

Make sure you FLUSH MAGENTO CACHE to see changes.

Enjoy :)