Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Improve X-Forwarded-For handling in realip

Omar Kilani
December 01, 2010 10:34PM
Hi Michael,

You should be able to get a list of subnets from your CDN, which you
can add to 'set_real_ip_from'. This way, you'll get the first
untrusted IP in the chain -- the scan works backwards, so even if your
XFF looked like:

X-Forwarded-For: proxy1 proxy2 client1

You'll get 'client1' if you add 'proxy1' or 'proxy2' to 'set_real_ip_from'.

And if your XFF looked like:

X-Forwarded-For: client1 proxy1 proxy2

You'll get 'client1' too -- hence the patch. :)

Regards,
Omar

On Thu, Dec 2, 2010 at 2:26 PM, Michael Shadle <mike503@gmail.com> wrote:
> On Wed, Dec 1, 2010 at 7:23 PM, Omar Kilani <omar.kilani@gmail.com> wrote:
>
>> The problem is that nginx doesn't do the "first IP in the header which
>> is not trusted" part -- it always returns the last IP in the
>> X-Forwarded-For header, no matter what.
>
> we have an issue where our CDN gives us the reverse XFF header - we
> really want the LAST ip, not the first one (or vice versa) and nginx
> gives us the first one which doesn't help :(
>
> making the realip behavior more configurable gets a big +1 from me.
> not sure if this is as configurable as it could be though.
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

[PATCH] Improve X-Forwarded-For handling in realip

Omar Kilani December 01, 2010 10:26PM

Re: [PATCH] Improve X-Forwarded-For handling in realip

mike December 01, 2010 10:30PM

Re: [PATCH] Improve X-Forwarded-For handling in realip

Omar Kilani December 01, 2010 10:34PM

Re: [PATCH] Improve X-Forwarded-For handling in realip

mike December 02, 2010 02:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 288
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