#1 2015-03-26 04:47:35

mbence
Trusted Member
Registered: 2015-03-25
Posts: 12

MegaVZ/NanoVZ reverse proxy should pass real client IP to the backend

Behind the NC reverse HTTP proxy all the requests seem to come from the same IP address, one that belongs to the proxy itself. Is there any way for the server to know each client's real IP address?

In similar setups the client IP address is passed on to the backend server in some HTTP header, usually the one called X-Real-IP or X-Forwarded-For. Some servers can use their values just like if the clients were directly connected. (They can write them to server logs and even use it for IP based access control. See mod_rpaf for apache and ngx_http_realip_module for nginx.)

Normally it's quite easy to add such a header in an nginx proxy:

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

That's why I wonder why it is not configured yet.

Can I ask to have such a header added?

P.S. The server side configuration would be equally simple:

set_real_ip_from nnn.nnn.nnn.nnn;
real_ip_header  X-Forwarded-For;

Offline

#2 2015-03-26 11:05:12

Backtogeek
Low End Boss
From: ~/
Registered: 2013-02-13
Posts: 3,500
Website

Re: MegaVZ/NanoVZ reverse proxy should pass real client IP to the backend

makes sense, haproxy does that.


http://LittleHappyCloud.net KVM VPS with 1TB Bandwidth for €3.00

Offline

#3 2015-03-26 12:24:48

RyanB
Trusted Member
From: Morphett Vale, SA
Registered: 2013-09-08
Posts: 868

Re: MegaVZ/NanoVZ reverse proxy should pass real client IP to the backend

I will adjust the proxy records in the morning. As you already know from your other post been trying to fix it a bit so will be adding this too smile

Offline

Board footer