title: Get requesters source IP
body: <p><strong>Issue:</strong></p>
  
  <ul>
  <li><code>x-forwarded-for</code> http header just shows 127.0.0.1 instead of the original ip</li>
  </ul>
  
  <p><strong>Setup</strong></p>
  
  <ul>
  <li>GKE</li>
  <li>gitlab ingress controller</li>
  </ul>
  
  <p><strong>Details</strong></p>
  
  <p>I tried to adapt the ingress rule with <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#enable-cors" rel="nofollow noreferrer">nginx CORS enablement</a> but no success.</p>
  
  <p>Here my ingress Annotation for the service:</p>
  
  <pre><code>nginx.ingress.kubernetes.io/cors-allow-headers: X-Forwarded-For
  nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS
  </code></pre>
  
  <p>And here the output via echoheaders app:</p>
  
  <pre><code>Hostname: backend-78dd9d4ffd-cwkvv
  
  Pod Information:
      -no pod information available-
  
  Server values:
      server_version=nginx: 1.13.3 - lua: 10008
  
  Request Information:
      client_address=10.60.8.16
      method=GET
      real path=/
      query=
      request_version=1.1
      request_scheme=http
      request_uri=[REDACTED]
  
  Request Headers:
      accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
      accept-encoding=gzip, deflate, br
      accept-language=en-GB,en-US;q=0.9,en;q=0.8
      cache-control=max-age=0
      connection=close
      cookie=_ga=[REDACTED]
      host=[REDACTED]
      upgrade-insecure-requests=1
      user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
      x-forwarded-for=127.0.0.1 &lt;--- why doesn't it show the source IP?
      x-forwarded-host=[REDACTED]
      x-forwarded-port=443
      x-forwarded-proto=https
      x-original-uri=/
      x-real-ip=127.0.0.1 &lt;--- why doesn't it show the source IP?
      x-scheme=https
  
  Request Body:
      -no body in request-
  </code></pre>