Client IP address when behind nginx reverse proxy

Are you having trouble getting Virtual Radar Server installed and running? If so then this is the place to ask about it.
DeWoert
Posts: 35
Joined: Mon Feb 29, 2016 9:36 pm

Client IP address when behind nginx reverse proxy

Postby DeWoert » Sat Feb 11, 2017 8:33 pm

I have VRS (almost) succesfully running behind an nginx reverse proxy.
nginx is running on a seperate raspberry, VRS is running on a Windows 2008R2 server.

VRS Site is running without problems, but client ip is allways the ip-address from the nginx reverse proxy.

Tested on other internal website, and there i can see the "real" client ip from the X-Forwarded-For header.

Tried changing the proxy settings in VRS WebSite, but no effect.

Any tips on how to get the "real" client-ip to show in VRS ?

Code: Select all

location /vrs/ {
  rewrite /vrs/(.*) /$1 break;
  proxy_pass http://x.x.x.x:8080;
  proxy_redirect off;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}


agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

Re: Client IP address when behind nginx reverse proxy

Postby agw » Mon Feb 13, 2017 2:25 am

I'll have a go and see if I can reproduce the problem.

Nevermind
Posts: 26
Joined: Thu Sep 11, 2014 12:36 am

Re: Client IP address when behind nginx reverse proxy

Postby Nevermind » Sun May 14, 2017 7:43 am

Is there already a solution? :)

agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

Re: Client IP address when behind nginx reverse proxy

Postby agw » Thu Jun 08, 2017 11:54 pm

I've been rewriting part of the server component so that it's OWIN compliant and I've not had a chance to try to reproduce this yet. However, I did have a look at the rules for determining the client's IP address when the request comes through a proxy - basically it's taken from the X-Forwarded-For header, but only if the proxy is on the LAN. If the request originates from a public internet address then X-Forward-For headers are ignored.

One thing about the original post - I've just noticed that X-Forwarded-For appears to be getting set twice? From what I've read of the documentation I think the first one where it gets set to $remote_addr is redundant.

ernieek
Posts: 6
Joined: Tue Aug 01, 2017 9:12 am
Contact:

Re: Client IP address when behind nginx reverse proxy

Postby ernieek » Mon Aug 07, 2017 12:22 pm

Hi,

is there any news?

i'm running vr behind a squid proxy.

I't would be very nice if I can see the real ip's in vr and also can use the ip restrictions :)

kind regards
Erwin


Return to “Installation Problems”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest