Closed ianwalter closed 3 years ago
I originally brought up this issue in #6845 where @aledbf replied
@ianwalter when you enable the proxy-protocol you are trusting that as the source of the truth, not the header. This change contradicts the configuration.
This makes me wonder if there is a discrepancy between how DigitalOcean implements the proxy protocol. In this blog post it says:
DigitalOcean Load Balancers implement Proxy Protocol version 1, which simply prepends a human-readable header containing client information to the data sent to your Droplet.
So doesn't this mean that you do need to use use-forwarded-headers: 'true'
so that those headers aren't ignored?
@ianwalter are you using ingress-nginx behind cloudflare?
If that's the case, then you don't need use-proxy-protocol: "true"
. Enabling this setting makes no sense in this scenario.
That said, you need something the next settings in the configuration configmap to use the headers from Cloudflare:
# https://www.cloudflare.com/ips
proxy-real-ip-cidr: "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/12,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,10.0.0.0/8"
use-forwarded-headers: "true"
forwarded-for-header: "CF-Connecting-IP"
@aledbf Yes, that was the problem. Turning off proxying in Cloudflare seems to have fixed the issue. Thank you for your help!
NGINX Ingress controller version:
v0.43.0
Kubernetes version (use
kubectl version
):Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:41:49Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Environment:
uname -a
):What happened:
What you expected to happen:
I expected the request to be served successfully by the backend.
I'm not sure what went wrong but adding
use-forwarded-headers: "true"
to the nginx-ingress ConfigMap properly serves the request. The request is also served properly if I removeuse-proxy-protocol: "true"
from the nginx-ingress ConfigMap and manually disable proxy protocol from the load balancer through the DigitalOcean UI.I'm wondering if proxy protocol should not be enabled by default or if there are other solutions to make this work out-of-the-box.
How to reproduce it:
Anything else we need to know:
During the too many redirects issue, the logs show:
162.xxx.xxx.xxx - - [04/Feb/2021:16:09:28 +0000] "GET / HTTP/1.1" 308 164 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15" 618 0.000 [prod-backend-8802] [] - - - - b0f584cb1ee5211bc80cd86e581fb3b
/kind bug