Booth Developer
2007-Nov-23 01:36 UTC
[Mongrel] Unable to read anything from request.remote_ip
For some users, request.remote_ip always return nil. According to the RAILS''s help: REMOTE_ADDR is the standard but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR are set by proxies so check for these before falling back to REMOTE_ADDR. HTTP_X_FORWARDED_FOR may be a comma- delimited list in the case of multiple chained proxies; the first is the originating IP. The system is running on the Mongrel Cluster behind Apache 2.2 with # mod_proxy, mod_proxy-html, and mod_proxy_balancer # mod_rewrite # mod_deflate # mod_headers (setup: http://mongrel.rubyforge.org/docs/apache.html) Would it be due to: 1) IPv6 or Asian IP addresses? 2) mod_proxy or mod_rewrite?? 3) .... Any insight? -- Posted via http://www.ruby-forum.com/.
Wayne E. Seguin
2007-Nov-23 03:32 UTC
[Mongrel] Unable to read anything from request.remote_ip
On Nov 22, 2007 8:36 PM, Booth Developer <lists at ruby-forum.com> wrote:> For some users, request.remote_ip always return nil. According to the > RAILS''s help: > > REMOTE_ADDR is the standard but will fail if the user is behind a proxy. > HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR are set by proxies so check > for these before falling back to REMOTE_ADDR. HTTP_X_FORWARDED_FOR may > be a comma- delimited list in the case of multiple chained proxies; the > first is the originating IP. > > The system is running on the Mongrel Cluster behind Apache 2.2 with > # mod_proxy, mod_proxy-html, and mod_proxy_balancer > # mod_rewrite > # mod_deflate > # mod_headers > (setup: http://mongrel.rubyforge.org/docs/apache.html) > > Would it be due to: > > 1) IPv6 or Asian IP addresses? > 2) mod_proxy or mod_rewrite?? > 3) ....Most likely the REMOTE_ADDR is not being forwarded to Mongrel from the mod_proxy* Best bet would be to checkout the mod_proxy* docs. ~Wayne
Booth Developer
2007-Nov-23 05:58 UTC
[Mongrel] Unable to read anything from request.remote_ip
we can view the REMOTE_ADDR for most access, but not all.> Most likely the REMOTE_ADDR is not being forwarded to Mongrel from the > mod_proxy* > Best bet would be to checkout the mod_proxy* docs. > > ~Wayne-- Posted via http://www.ruby-forum.com/.