*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!
Hey, I was thinking about switching to mosso and this will help out a lot when making that move!
-Jason
So will this work with WordPress 2.7?
I’ve tested this issue with WordPress 2.7 on Mosso. I didn’t go into great length, but it seems to work fine with a quick sanity check. But, I found an open ticket on WordPress Trac that is similar to this issue.
[...] read an interesting post over at FreshClicks.net about a potential issue with WordPress obtaining the remote address environment variable when [...]
[...] 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 [...]
Hey Terry, I don’t if you are using a plugin to solve your WordPress 2.7 with Mosso problem, but right out of the box it will have this IP address issue. This article was written to cover 2.6. I have just released an updated article that covers 2.7 here: http://www.freshclicks.net/2009/01/15/syndicated-content-and-rss/mosso-how-to-fix-comment-ip-addresses-in-wordpress-27/
I was thinking about Mooso, but was told that WordPress was pretty intense in the context of the “compute cycle” phenomenon.
Have you Moolo + WordPress bloggers experienced reasonable bills each month?
To wrap some context around my concerns, we average about a million page views per month on our blogs – and growing.
James,
I talked with mosso and this is what they said 10,000 cycles typically covers:
* about 2.1 million page views using a database-driven content management system
* about 11 million page views of mosso.com
* about 25 million requests for a static 15KB image
I asked them about a WordPress blog at 3 million pages views per month and they said that it would be fine.
If you happen to use the StatPress module, I was able to solve the same problem there by editing statpress.php and changing both locations that contained REMOTE_ADDR as shown above.
Hey admin,
Here is where the files are located at
content/wp-includes/comment.php around line 718
[...] read an interesting post over at FreshClicks.net about a potential issue with WordPress obtaining the remote address environment variable when [...]