# Remote\_ip always returns 127.0.0.1 (apache)

**URL:** <https://www.ruby-forum.com/t/remote-ip-always-returns-127-0-0-1-apache/144349>\
**Category:** Rails\
**Created:** [July 28, 2008, 10:09pm UTC](https://www.ruby-forum.com/t/remote-ip-always-returns-127-0-0-1-apache/144349 "2008-07-28T22:09:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [July 28, 2008, 10:09pm UTC](https://www.ruby-forum.com/t/remote-ip-always-returns-127-0-0-1-apache/144349/1 "2008-07-28T22:09:12Z")

</div>

Hi All

I have my webrick server behind apache (all on the same server). The  
problem I have now is that request.remote\_ip always returns 127.0.0.1.  
So it gets this IP from apache (I guess). How do I get the true client  
IP address

Cheers  
LuCa

---

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [July 28, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/remote-ip-always-returns-127-0-0-1-apache/144349/2 "2008-07-28T22:29:26Z")

</div>

On Mon, Jul 28, 2008 at 3:09 PM, Luca S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have my webrick server behind apache (all on the same server). The  
> problem I have now is that request.remote\_ip always returns 127.0.0.1.  
> So it gets this IP from apache (I guess). How do I get the true client  
> IP address

request.env[‘HTTP\_X\_FORWARDED\_FOR’]

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [July 28, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/remote-ip-always-returns-127-0-0-1-apache/144349/3 "2008-07-28T22:35:32Z")

</div>

yes, thnx a lot!!
