Askimet plugin – clustered hosting conflict

I use the Askimet plugin on this blog, as well as another, to help minimize the spam comments. I recently started to realize that I was getting no comments, and couldn’t figure out why? So I checked my admin panel, and looked at the spam and plenty was there, and nothing that shouldn’t be. So, today I just checked again, and there were a few that were legitimate comments, being marked as spam. Then I noticed the problem.

Askimet had every single comment as coming from the same IP address. Hmmmm, this problem sounds familiar… A little poking in the Askimet.php file, and viola, there it is. Basically, the problem is that since I run on a cluster/grid environment at Mosso.com, the IP address is reported as the IP of the node on which the site is running at that time (or something like that). It was actually a 10dot address which in retrospect is a DUH, since that is a non-routable internal address.

The culprit is this: $_SERVER['REMOTE_ADDR'] It should actually read: $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] Now of course this is for mosso, but I am pretty sure that most clustering PHP systems use the server-variable name of HTTP_X_CLUSTER_CLIENT_IP to pass the external IP of the requester to the web application. It may be different for you, but the concept is still the same. Just open the askimet plugin file, search for REMOTE_ADDR and then replace it with HTTP_X_CLUSTER_CLIENT_IP (or your variable name for your environment), and that should be it. It’s only in 1 place.

Unfortunately, the change is not retroactive, but at least it will work correctly. Interesting though that clusters do not actually function as advertised, which is “magic huge computer that grows as you need it”.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>