Mosso – How to fix comment IP addresses in WordPress 2.7

wordpress 2.7 mossoI 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!