Closed noqcks closed 4 years ago
/assign @aledbf
use-forwarded-headers: "true" use-proxy-protocol: "true"
These two annotations don't work together. If you enable the two, only the use-proxy-protocol will be used.
Please add the annotation
nginx.ingress.kubernetes.io/server-snippet: |
real_ip_header X-Forwarded-For;
@noqcks it works?
Yes! It worked! Thank you!
Tried on 0.21.0 (an older version we're running). If you had any idea what might make it work also on 0.21.0 that would be very helpful too.
If you had any idea what might make it work also on 0.21.0 that would be very helpful too.
Unfortunately, in versions older than 0.26.0 is not that easy. You should try to update to a more recent version
Yep, I figured that was the case. Thank you.
NGINX Ingress controller version: 0.30.0
Kubernetes version (use
kubectl version
): 1.15.9Environment: Kops on AWS
uname -a
): Linux ip-172-20-1-51 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 GNU/LinuxWhat happened:
We are attempting to setup a our ingress so that we have traffic like so
Previously it was ELB -> Nginx Ingress and everything worked. However, once we switched to add CloudFront our IP whitelisting no longer works. The reason for this I believe is that the real_ip is being set incorrectly.
This is what our logs look like
My Client/Computer IP =
18.232.45.xxx
The IP that's listed under
remote_addr
(70.132.33.156) is using $proxy_protocol_addr and is from the CloudFront IP address range. This is also used by real_ip module hereconfigmap (the proxy-real-ip-cidr list contains all the CloudFront IP addresses as well as our VPC CIDR (172.20.0.0/16))
And a simple ingress i'm using to test whitelisting
What you expected to happen:
I expected whitelisting to work correctly based on the correct IP (18.232.45.xxx), but it seems to checking whitelist against the CloudFront IP (70.132.33.156) instead. If I update my upstream whitelist to allow
70.132.33.156
I no longer get a 403 error.How to reproduce it:
Setup a CloudFront Origin pointing to an ELB. See screenshots below for exact settings.
Setup a new ingress that has IP whitelisting for your IP address.
Supplementary Links:
Similar Issues:
/kind bug