Welcome! Log In Create A New Profile

Advanced

Re: Set real ip not working

Francis Daly
May 09, 2018 04:38PM
On Wed, May 09, 2018 at 02:19:23PM -0400, snir wrote:

Hi there,

> I want to get the real ip of the client but I'm all ways getting the ip of
> the ngnix server.

What, specifically, do you mean by "getting the ip"?

> I trayed using set_real_ip:

The tcp connection from nginx to upstream will (almost) always come from
an IP address of the nginx machine.

It is possible that nginx can be configured to write a client IP address
into a http header, that the upstream server can then be invited to read.

For that, you will want to make sure to write the client IP address into
a http header (proxy_set_header, perhaps $proxy_add_x_forwarded_for) and
you will want to make sure to configure your upstream server to read it.


For one test request, what is the client IP address that you care
about? Do you see that IP address anywhere in the request from nginx to
upstream? If not, fix that. If so: do you see upstream doing anything
with that part of the request? If not, fix that.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Set real ip not working

snir May 09, 2018 02:19PM

Re: Set real ip not working

Francis Daly May 09, 2018 04:38PM

Re: Set real ip not working

snir May 10, 2018 08:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready