Correct User IP for WordPress comments on Mosso

Update #2: It looks like a couple of days after I posted this, the Mosso guys sent word on fresh clicks that the issue has been fixed on their end, rendering this plugin completely useless, days after I put it up. 🙂

I stumbled across a problem running WordPress on Mosso (Rackspace Clould) servers (which I’m now quite happily running unFocus.com on 🙂 ) in the Mosso Knowledge Base, where the ip address of the user is not properly recorded in comments when running in the Mosso cluster. The knowledge based linked to a fresh clicks article, but I wanted something a little easier to maintain than an inline hack. So I rolled a quick and dirty plugin, which seems to do the trick. Here is what it does:

<?php
/*
Plugin Name: unFocus.Mosso-User-IP
Plugin URI: http://www.unfocus.com/projects/
Description: A plugin to set REMOTE_ADDR on Mosso clusters to
HTTP_X_CLUSTER_CLIENT_IP to fix tracking and comment posts, etc.
Version: 1.0a
Author: Kevin Newman
Author URI: http://www.unfocus.com/projects/
*/

function unFocus_MossoUserIP() {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
}
add_action('init', 'unFocus_MossoUserIP');
?>

That’s it! It just sets the regular REMOTE_ADDR value to the Mosso Server var HTTP_X_CLUSTER_CLIENT_IP. Pretty simple. 🙂 Update: I forgot to upload a zip archive. unFocus.Mosso-User-IP.zip

Author: Kevin Newman

I’m the lead developer at adcSTUDIO located in Kingston NY (in Livingston Manor NY before that). I do all kinds of things there, from robust server side work to the much more enjoyable client side development in HTML/JavaScript/Flash (RIAs, HTML5, etc.) and all the other tech-buzz-phrases of the moment.

My brother came up with the idea for unFocus.com which was originally meant be a place to discuss and blog about whatever topics we both found interesting, from politics to technology, to art and design. Time was scarce, and I need a place to host History Keeper, and unFocus Projects – a sub focus of unfocus.com was born, and eventually migrated to the font page.

Oh, and I’m on Twitter (@Touvan) and Google+.

Leave a Reply

Your email address will not be published. Required fields are marked *