Last Updated: February 25, 2016
·
8.684K
· bartlomiejdanek

AWS ELB + nginx real IP address

Just add following lines into your Nginx configuration in http section.

real_ip_header     X-Forwarded-For;
set_real_ip_from   0.0.0.0/0;

3 Responses
Add your response

Also.. welcome in some fun security exploits.

over 1 year ago ·

@whardier, do you know better solution?

over 1 year ago ·

I think

real_ip_header     X-Forwarded-For;
set_real_ip_from   10.0.0.0/8;
set_real_ip_from   172.16.0.0/12;
set_real_ip_from   192.168.0.0/16;
real_ip_recursive on;

(realiprecursive because the ELB might bounce the traffic off more than 1 IP)

And now you can limit the port to a security group of the ELB so noone else can hit it anyway.

over 1 year ago ·