Forum: NGINX Forward IP address to proxied server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7515cb5c8df2d07f6d3780346ec0da92?d=identicon&s=25 Daniel Mircea (viseztrance)
on 2008-10-16 02:02
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;
}

--
# 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
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 mike (Guest)
on 2008-10-16 02:15
(Received via mailing list)
sounds like a thttpd config issue :p

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
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-09-07 10:27
(Received via mailing list)
Wanted to provide a solution to this thread since it still applies:

http://wiki.nginx.org/ThttpdRealIP

Cliff
This topic is locked and can not be replied to.