I enjoy using Mosso servers to host my marketing blog and many other client sites. I started using their “hosting cloud” technology shortly after they launched and with only a few hiccups in the beginning, they have performed amazingly well. Since Mosso is on a cluster (Cloud server) I do occasionally run into problems. One of which I documented regarding how Mosso messes up up the comment IP address in WordPress 2.6. Well I updated my blog to WordPress 2.7, which is great but that IP address problem came back. The old solution didn’t work so I did some digging around and this is what I found.
Problem
Comments come into my blog and they all show that the IP address of the sender is the same. The WordPress application was seeing the IP address of the load balancing technology and not the IP address of the person adding the comment. This happens because Mosso’s load balancing technology sits in front of the web servers.
The new solution
Having tried to implement my old solution I discovered that enough had changed in WordPress 2.7 that my hack no longer worked. Instead I had to change one simple line of code in the wp/include/comment.php directory.
In file wp-includes/comment.php around line 971 change:
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] );
into this:
,$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] );
That’s it! All of the comments will once again record the appropriate IP address associated with the person making the comment and I can start black listing those spam comment at the IP address level. Or catch companies trying to pretend to be their own customers praising their products — You know who you are!
If you find this article helpful make sure to add a comment and let me know!
Related posts:
Great write up! Thanks for sharing the tip.
This still doesn’t work for me. is there ANYBODY who can help me?? I am desperate!!
Hey admin,
Here is where the files are located at
content/wp-includes/comment.php around line 718
@curtis allen
Actually Curtis can you check which version of WordPress you are refering to as I just doublecheckd my WordPress 2.7 content/wp-includes/comment.php file and it is located at line 971.
Hey Everyone,
I’m an Account Manager over at Mosso and we have recently made a change to our PHP platform. This change corrects these issues complete and no longer requires modification to your code to get the correct IP address.
Here is a link to the knowledge base article on the change: http://help.mosso.com/article.php?id=362
All current customers should have also received a email sent to the primary contact on their account as well. As always, if you have any questions please feel free to contact us.
Daniel Sustaita
Account Manager
Mosso | The Rackspace Cloud
Thanks Daniel,
That is great news! I’ll update this article to reflect the new changes to Mosso’s new capabilities.
-Lary