Mosso and WordPress

wordpress mossoI 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. 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

Lucklily 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!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati

One Response to “Mosso and WordPress”

  1. Hey, I was thinking about switching to mosso and this will help out a lot when making that move!

    -Jason

Discussion Area - Leave a Comment