Mosso and WordPress 2.6

wordpress mosso*I’ve update this issue for WordPress 2.7 and Mosso*
I use Mosso to host all of my web hosting accounts. They may be more expensive then other hosted servers but Mosso scales automatically (they call it their “hosting cloud”) and will keep your site up and running when you get hit by the unexpected spike in traffic do to some stumble-upon or other viral phenomenon.

The Problem

I ran into a problem with my installation of WordPress 2.6. I had a couple of comments come into my blog and I noticed something strange. They had the same IP address. Was someone pretending to be two different people and commenting on my article? For shame! Actually, on closer inspection I noticed that the IP address for ALL of the comments were the same, even my own replies. It turns out that the WordPress application was seeing the IP address of the load balancers and not the IP address of the person adding the comment. This happens because Mosso’s load balancers sit in front of their webservers.

The Solution

Luckily the solution was easy. I just located the comment.php file in the directory of my active theme.
wp-content/themes/[name of theme]/comment.php

Then just searched for:

$_SERVER[‘REMOTE_ADDR’];

and replaced it with:

$_SERVER[‘HTTP_X_CLUSTER_CLIENT_IP’];

That’s it! All of the comments now have the appropriate IP address associated with them and I can start black listing that spam comment at the IP address level!

If you find this article helpful make sure to add a comment and let me know!