Nginx Behind CDN and load balancer

Associate
Joined
21 Feb 2017
Posts
84
Location
South West London
Hi All

I'm running a nginx web server in aws. The DNS points to a CDN which then points to an ELB in AWS.
I'm trying to get the client IP to show in the logs but I can only get the IP of the CDN servers.

I've added the config to nginx to get the real IP, what I have is:

real_ip_header X-Forwarded-For; # Original IP in X-Forwarded-For from ELB
set_real_ip_from x.x.0.0/15; # Trusted for Production and Dev AWS VPCs
set_real_ip_from x.x.x.x/24; # Trusted for CDN servers

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

Anyone have any idea what needs to be changed?

Thanks
 
Back
Top Bottom