-
Notifications
You must be signed in to change notification settings - Fork 8.4k
client IP is incorrect when using CloudFront -> ELB -> Nginx and proxy protocol #5233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/assign @aledbf |
These two annotations don't work together. If you enable the two, only the use-proxy-protocol will be used. Please add the annotation
|
@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. |
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. |
Uh oh!
There was an error while loading. Please reload this page.
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 Basic structure #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
The text was updated successfully, but these errors were encountered: