-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
X-Forwarded-For wrong with enable-real-ip #11994
Comments
This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The description in docs says this
so I had assumed until now that its just the CIDR of the external-LB. And the reason for configuring this was to trust only and only that specific external-LB, for sending the valid X-Forwarded-* info to the controller and the backend . |
I am ok to trust only LB set in I don't see any use for this. The resulting X-Forwarded-For header should be |
Thanks for comments. Your comments suggest a authoritative info needs to become available here as a comment. There are not many resources available here on github. There are at least some more than here on the Kubernetes slack. I myself am seeing my limited knowledge on this. Because when you say
I assume you had a shell on the host, whose default route or own ipaddress was 10.20.30.40 . |
Just a dumb question, not sure if it makes a difference, but have you tried actually setting a CIDR and not just an IP address? So |
Apart from that I remember that |
I've done tests with plain nginx. 1️⃣ First,
So this has no use with realip module. 2️⃣ Second: 3️⃣ Third. In the short term we'll use: enable-real-ip: true
proxy-real-ip-cidr: 10.20.30.40 and add This is suboptimal, because the LB IP is not sent to backend. 4️⃣ Fourth. It would be great to send a safe Here is how I've done it with plain nginx: server {
set_real_ip_from 10.20.30.40;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
if ($remote_addr = $realip_remote_addr) {
set $safe_x_forwarded_for "$remote_addr";
}
if ($remote_addr != $realip_remote_addr) {
set $safe_x_forwarded_for "$http_x_forwarded_for, $realip_remote_addr";
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $safe_x_forwarded_for;
# ...
location / {
proxy_pass https://10.11.12.13:8080
}
# ...
} and adding NB: I've tested with httpbin image to the path |
This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach |
This is not stale. I can move this forward and add a new parameter, but this will be harder to understand how all parameters go together. How to move forward? |
What happened:
When setting :
and testing from 10.20.30.40 with:
curl -kv https://hello-world.example.org--header "X-Forwarded-For: 192.168.1.1"
The following variables will be defined:
What you expected to happen:
The following variables to be defined:
Other tests
We tried the following:
proxy-real-ip-cidr: 10.20.30.40
enable-real-ip: true
use-forwarded-headers: true
compute-full-forwarded-for: true
$remote_addr
$proxy_add_x_forwarded_for
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.): v1.11.2
The text was updated successfully, but these errors were encountered: