Remote IP lost when using Lighttpd + Pound -- use Lighttpd + Pen instead
If you’ve tried following the latest advice on Rails server setup over at the Riding Rails blog, you’ll have found that it breaks the
request.remote_ip by making it always return 127.0.0.1. Useless.
The problem is that Pound blindly insists on adding an X-Forwarded-For header to every request it passes, whether or not that header is already present. Consequently, it overrides the X-Forwarded-For header already added by Lighttpd, and information about the originating IP is lost.
The solution is to drop Pound and replace it with another proxy that handles the X-Forwarded-For header more intelligently. I’ve decided on Pen, where you can simply leave out the “-H” command line option and everything works. See the documentation for Pen + Mongrel for more details.
Another advantage is that there’s no funky configuration issues, like crashing without any messages when you leave out a configuration option that the documentation doesn’t say is required.