Get Client Real IP on Container Behind AWS ALB

I have single container running in an EC2 instance behind an AWS Application Load Balancer.

The container is running using network_mode=host and displaying a simple JSON of the Request Info and Headers.
Problem is, I don’t get the Client Real IP. Instead, I get an internal IP in the X-Forwarded-For Header.


  • ALB Scheme is Internal
  • We use an enterprise proxy

What am I missing?

The JSON response:

  "path": "/",
  "headers": {
    "x-forwarded-for": "10.XXX.XX.XX",
    "x-forwarded-proto": "http",
    "x-forwarded-port": "80",
    "host": "",
    "x-amzn-trace-id": "Root=1-XXXXXXX",
    "cache-control": "max-age=0",
    "upgrade-insecure-requests": "1",
    "user-agent": "Mozilla/5.0 ...",
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
    "accept-encoding": "gzip, deflate",
    "accept-language": "en-US,en;q=0.9",
    "cookie": "XXXX"
  "method": "GET",
  "body": "",
  "fresh": false,
  "hostname": "",
  "ip": "::ffff:10.YYY.YY.YY",
  "ips": [],
  "protocol": "http",
  "query": {},
  "subdomains": [
  "xhr": false,
  "os": {
    "hostname": "ec2-instance"

Source: StackOverflow