Rackspace recently launched their load balancer service to the public, it’s an awesome service/appliance. It’s easy to setup, and works out of the box for most things. One thing we noticed that changed was that the REMOTE_ADDR of the visitor was no longer visible, most comments were being posted from the ip address of the load balancer, instead of the visitor. This also causes issues when you have IPS/IDS systems in place, that deny access based on X number of brute force attempts.

So, I did some research and found that Rackspace uses X-CLUSTER-IP in the HTTP header to send the ip address of the visitor.

We use the excellent mod_rpaf module with our apache installs, so we just had to change the setting from

RPAFheader X-Forwarded-For



This allows PHP to see the right ip of the visitor for REMOTE_ADDR, so you don’t need to change your PHP code/plugins etc to work.

2 thoughts on “Accessing the remote ip of the user via Rackspace Load Balancers

  1. jstraw

    Just as a note, a change to the Load Balancer service added X-Forwarded-For as well, so the change to X-Cluster-Client-IP is not required anymore.

Leave a Reply