title: Traefik behind a layer 4 AWS legacy network load balancer -- how to add requestor IP address into access logs
body: <p>I am using Traefik inside of Kubernetes and there is an AWS layer 4 level legacy network load balancer in front. I am trying to add the original requestor ip address into the Traefik access logs, but I cannot get it working.</p>
  <p>Here is the relevant Traefik configuration <em>(in Helm yaml format)</em>:</p>
  <pre><code>  proxyProtocol:
      enabled: true
      trustedIPs:
        - 192.168.0.0/16
        - 10.0.0.0/8
        - 172.16.0.0/12
  
    forwardedHeaders:
      enabled: true
      # trustedIPs is required when enabled
      trustedIPs:
        - 192.168.0.0/16
        - 10.0.0.0/8
        - 172.16.0.0/12
  </code></pre>
  <p>And here is the access logs configuration:</p>
  <pre><code>  accessLogs:
      enabled: true
      ## Path to the access logs file. If not provided, Traefik defaults it to stdout.
      # filePath: &quot;&quot;
      format: common  # choices are: common, json
      ## for JSON logging, finer-grained control over what is logged. Fields can be
      ## retained or dropped, and request headers can be retained, dropped or redacted
      fields:
        # choices are keep, drop
        defaultMode: keep
        names: {}
          # ClientUsername: drop
        headers:
          # choices are keep, drop, redact
          defaultMode: keep
          names:
            &quot;X-Forwarded-For&quot;: keep
            &quot;X-Real-IP&quot;: keep
  </code></pre>
  <p>My access logs with this configuration look like the following though. No headers or X-Forwarded-For IP shown:</p>
  <p><a href="https://i.stack.imgur.com/bXbbj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bXbbj.png" alt="enter image description here" /></a></p>