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


Hey there, I find that when Pound is in front of Lighty, everything works much better. I just wrote up an article on it. See what you think:
By Rob Orsini on Sun, Jul 09, 06 at 10:11 · Reply
Interesting, thanks for the link. One thing I like about the Pen setup is that it's literally a two-line setup: <code>apt-get install pen pen 7999 localhost:8000 localhost:8001 localhost:8002</code> That's roughly what my setup and config looks like. That's simple.
By Lars Pind on Sun, Jul 09, 06 at 10:11 · Reply

Leave a comment