# Forward IP address to proxied server

**URL:** <https://www.ruby-forum.com/t/forward-ip-address-to-proxied-server/151027>\
**Category:** NGINX\
**Created:** [October 16, 2008, 2:02am UTC](https://www.ruby-forum.com/t/forward-ip-address-to-proxied-server/151027 "2008-10-16T02:02:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danmcb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@danmcb](https://www.ruby-forum.com/u/danmcb)\
**Post date:** [October 16, 2008, 2:02am UTC](https://www.ruby-forum.com/t/forward-ip-address-to-proxied-server/151027/1 "2008-10-16T02:02:34Z")

</div>

Hi everyone,

I’m using nginx as a reverse proxy for a thttpd server that handles cgi  
scripts.  
Everything works ok, except that the server doesn’t seem to receive any  
visitor info, every IP is interpreted as 127.0.0.1.

This is the config, that I’m using to forward requests:

location ~ .cgi$ {  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Host $http\_host;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_pass [http://127.0.0.1:30001](http://127.0.0.1:30001);  
}

–

# nginx -V

nginx version: nginx/0.6.31  
built by gcc 4.1.2 20070626 (Red Hat 4.1.2-14)  
configure arguments: --prefix=/opt/local/nginx  
–sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log  
–http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid  
–lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx  
–with-http\_ssl\_module --with-http\_flv\_module --with-http\_dav\_module

---

<div class="post-metadata">

**Author:** ![danmcb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@danmcb](https://www.ruby-forum.com/u/danmcb)\
**Post date:** [October 16, 2008, 2:15am UTC](https://www.ruby-forum.com/t/forward-ip-address-to-proxied-server/151027/2 "2008-10-16T02:15:47Z")

</div>

sounds like a thttpd config issue 😛

unless thttpd has a way to say that “x-forwarded-for” is the true ip,  
you’re going to have to modify the app to use that IP etc

---

<div class="post-metadata">

**Author:** ![danmcb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@danmcb](https://www.ruby-forum.com/u/danmcb)\
**Post date:** [September 7, 2009, 10:27am UTC](https://www.ruby-forum.com/t/forward-ip-address-to-proxied-server/151027/3 "2009-09-07T10:27:29Z")

</div>

Wanted to provide a solution to this thread since it still applies:

[http://wiki.nginx.org/ThttpdRealIP](http://wiki.nginx.org/ThttpdRealIP)

Cliff
