# Client ip address using proxy\_pass and issues

**URL:** <https://www.ruby-forum.com/t/client-ip-address-using-proxy-pass-and-issues/185906>\
**Category:** NGINX\
**Created:** [March 29, 2010, 3:49am UTC](https://www.ruby-forum.com/t/client-ip-address-using-proxy-pass-and-issues/185906 "2010-03-29T03:49:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/2acd7d/32.png) [@kevin](https://www.ruby-forum.com/u/kevin)\
**Post date:** [March 29, 2010, 3:49am UTC](https://www.ruby-forum.com/t/client-ip-address-using-proxy-pass-and-issues/185906/1 "2010-03-29T03:49:27Z")

</div>

i am trying to move from nginx-\>fastcgi to nginx-\>apache-\>fastcgi

this how i have configured proxy\_pass to my apache running on 2080.  
my app gets the client ip address as 127.0.0.1. how to make it see the  
correct real ip address.

```
    location / {
        root /home/live/work/apps;
        proxy_pass http://127.0.0.1:2080/$host$request_uri;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header IP_GEO $geo;
    }

```

i get the server address as this ‘SERVER\_ADDR’: ‘127.0.0.1’, how to fix  
this?

the IP\_GEO header gets converted to HTTP\_IP\_GEO, is there anyway to  
avoid  
this as my python app uses IP\_GEO everywhere.

thanks a lot!

---

<div class="post-metadata">

**Author:** ![kevin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/2acd7d/32.png) [@kevin](https://www.ruby-forum.com/u/kevin)\
**Post date:** [March 29, 2010, 6:52am UTC](https://www.ruby-forum.com/t/client-ip-address-using-proxy-pass-and-issues/185906/2 "2010-03-29T06:52:38Z")

</div>

Hello!

On Mon, Mar 29, 2010 at 07:18:30AM +0530, kevin wrote:

> ```
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Host $host;
> proxy_set_header IP_GEO $geo;
> }
> 
> ```
> 
> i get the server address as this ‘SERVER\_ADDR’: ‘127.0.0.1’, how to fix  
> this?

You should use mod\_realip/mod\_rpaf2 on Apache side.

> the IP\_GEO header gets converted to HTTP\_IP\_GEO, is there anyway to avoid  
> this as my python app uses IP\_GEO everywhere.

Again, you should handle this on Apache side. nginx just passes  
headers with information, nothing more.

Maxim D.
