# Mongrel handler

**URL:** <https://www.ruby-forum.com/t/mongrel-handler/157210>\
**Category:** Mongrel\
**Created:** [January 8, 2009, 2:17pm UTC](https://www.ruby-forum.com/t/mongrel-handler/157210 "2009-01-08T14:17:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sathish\_303](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sathish\_303](https://www.ruby-forum.com/u/sathish_303)\
**Post date:** [January 8, 2009, 2:17pm UTC](https://www.ruby-forum.com/t/mongrel-handler/157210/1 "2009-01-08T14:17:11Z")

</div>

When i try to get the remote address of the system ,its returning only  
the proxy server ip or localhost ip address.But i need the service  
provider ip address of the system.Is there is any http header  
variables,because i used ([‘REMOTE\_ADDR’]  
,[‘SERVER\_NAME’],[‘REMOTE\_HOST’],[‘SERVER\_PORT’],[‘HTTP\_HOST’]) nothing  
works for me . I need the solution for this can you please suggest with  
me the solution.

thanks,

---

<div class="post-metadata">

**Author:** ![sathish\_303](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sathish\_303](https://www.ruby-forum.com/u/sathish_303)\
**Post date:** [January 8, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/mongrel-handler/157210/2 "2009-01-08T15:47:14Z")

</div>

You will not get these things from any of those variables. If you are  
using  
Apache look for “set X-FORWARDED-FOR”. In fact X-FF can be used to get  
ip  
address for many http servers. More info at

> **[X-Forwarded-For](https://en.wikipedia.org/wiki/X-Forwarded-For)**
>
> The X-Forwarded-For (XFF) HTTP header field is a common method for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.
> The X-Forwarded-For HTTP request header was introduced by the Squid caching proxy server's developers.\[citation needed\]
> X-Forwarded-For is also an email-header indicating that an email-message was forwarded from one or more other accounts (probably automatically).
> Without the use of XFF or another similar techni...

---

<div class="post-metadata">

**Author:** ![sathish\_303](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sathish\_303](https://www.ruby-forum.com/u/sathish_303)\
**Post date:** [January 8, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/mongrel-handler/157210/3 "2009-01-08T19:09:42Z")

</div>

Hmm, I’ve never had this problem with a Mongrel in front of Rails via  
Apache, using the standard Apache mod\_proxy reverse proxy setup for  
apache and mongrel.

My guess is that that mod\_proxy in apache will automatically set  
X-FORWARDED-FOR without the need for any special setup beyond the  
reverse proxy setup; and that Rails will also automatically use that  
x-ff header. But I’ve never looked into it, because I didn’t need, it  
just worked.

If you are not using apache and/or not using Rails, your mileage may  
very. What is your environment?

Jonathan

Piyush R. wrote:

> > the proxy server ip or localhost ip address.But i need the service  
> > Mongrel-users mailing list  
> > removed\_email\_address@domain.invalid  
> > [http://rubyforge.org/mailman/listinfo/mongrel-users](http://rubyforge.org/mailman/listinfo/mongrel-users)

–  
Jonathan R.  
Digital Services Software Engineer  
The Sheridan Libraries  
Johns Hopkins University  
410.516.8886  
rochkind (at) jhu.edu
