<p>I'm using Cloudflare as CDN and it's hiding the real IP address for the clients
I'm using an NGINX ingress controller as a loadbalancer running in Google Kubernetes engine 
So I'm trying to restore the original IP address and trying to follow this link <a href="https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-" rel="nofollow noreferrer">https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-</a>
How can I implement this in the configmap for my Nginx ingress since I need multiple value for the same key "set-real-ip-from" ?</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingressname
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/affinity: "cookie"
    nginx.ingress.kubernetes.io/session-cookie-name: "route"
    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
spec:
  tls:
  - hosts:
    - example.com
    secretName: sslcertificate
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: service
          servicePort: 80
        path: /
</code></pre>

<p>I also had this problem and it took me forever to fix but apparently all I needed was this configuration:</p>
<pre><code>apiVersion: v1
data:
  # Cloudflare IP ranges which you can find on https://www.cloudflare.com/ips/
  proxy-real-ip-cidr: &quot;173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22,2400:cb00::/32,2606:4700::/32,2803:f800::/32,2405:b500::/32,2405:8100::/32,2a06:98c0::/29,2c0f:f248::/32&quot;
  # This is the important part
  use-forwarded-headers: &quot;true&quot;
  # Still works without this line because it defaults to X-Forwarded-For, but I use it anyways
  forwarded-for-header: &quot;CF-Connecting-IP&quot;
kind: ConfigMap
metadata:
  name: nginx-configuration
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
</code></pre>
<p>IMO this is all really unclear from the documentation. I had to search through tons of issues and the actual template file itself to figure it out.</p>
