<p>I'm using CloudFlare as DNS server for the system and need of whitelist IP for some domains of the system. I managed to do this but when I enable <code>Proxy status</code> feature for domain on CloudFlare I get <code>403 Forbidden</code> error because CloudFlare forwards its own IP for <code>ingress</code> instead of client IP address.<br />
I found a tutorial <a href="https://support.cloudflare.com/hc/en-us/articles/200170786" rel="nofollow noreferrer">here</a>.<br />
Is there any other way to solve this problem?<br />
Here is the CloudFlare configuration.</p>
<p><a href="https://i.stack.imgur.com/cY2p9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cY2p9.png" alt="enter image description here" /></a></p>
<p>Here is the <code>ingress</code> configuration.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: admin-ingress
  namespace: machine-learning
  labels:
    app.kubernetes.io/managed-by: Helm
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 50m
    nginx.ingress.kubernetes.io/whitelist-source-range: 184.90.9.99,183.88.6.88
spec:
  rules:
    - host: &quot;admin.xxx.com&quot;
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: admin-service
                port:
                  name: http
</code></pre>
<p>And this is the error I get</p>
<p><a href="https://i.stack.imgur.com/LJsoN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJsoN.png" alt="enter image description here" /></a></p>
<p>Any contribution is greatly appreciated.<br />
Best regards,</p>

quoc9x
<p>Please add this line
real_ip_header CF-Connecting-IP;
in your Nginx config file to forward the original client IP address to the server.</p>
