client ip address using proxy_pass and issues

Maxim Dounin mdounin at
Mon Mar 29 08:52:11 MSD 2010


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

> 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 how to make it see the
> correct real ip address.
>         location / {
>             root   /home/live/work/apps;
>             proxy_pass$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': '', 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 Dounin

More information about the nginx mailing list