Original IP not passed to container on single container Docker image on AWS Elastic Beanstalk Original IP not passed to container on single container Docker image on AWS Elastic Beanstalk docker docker

Original IP not passed to container on single container Docker image on AWS Elastic Beanstalk


With Hapi for Node.js, request headers are not available with request.info but with request.headers. Using request.info returns network level informations. You should use something like request.headers[ 'X-Forwarded-For' ] to get request level informations. Try displaying request.headers key-value pairs to discover the key that is linked to a value containing the IP address you want to find.


This has already been touched on by Alexandre Fenyo, but if you are behind a load balancer this is probably what's being passed to your app as the client IP.

You can configure your nginx to set real_ip_header: X-Forwarded For and real_ip_recursive: on. This means nginx will scan the list of IPs you're receiving and set the client's as the first untrusted IP. You also need to pass a list of trusted IPs, which should be the CIDR block for your load balancer.

There's more detailed descriptions and answers here