I have been taking a long, hard look at Nginx recently. First I was playing around with it as a load balancer and the ease of getting it setup really got my attention. After playing around with my cluster for a while I needed something else to play with so I decided to remove Apache from my standard server configuration and added Nginx.
I quickly had everything setup and running, but I noticed the remote address in the CGI scope was coming back as 127.0.0.1 which is not exactly what I was looking for. Looking at the proxy settings in my Nginx config I had set all the right proxy headers, but Tomcat was ignoring the proxy headers. Doing a few quick searches I have seen this was an issue, but you could read the real ip address by examining the headers and pulling the appropriate header field, etc. That is great, however I am lazy and I would prefer to do it automagically.
So I decided to do a little more searching. As it turns out, Tomcat version 6.0.24 added a way to translate the X-Real-IP header and allow Railo to use that without having to do any header-fu. All you have to do is add one line to your server.xml under the <Engine> container:
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
Dumping out the CGI scope you should now see the remote address of the user instead of the address of the proxy server. Hopefully this will save someone some time because I know it sure drove me crazy for a long time last night.