Ingress-nginx: X-Real-IP and X-Forwarded-For missing

Created on 31 May 2017  路  11Comments  路  Source: kubernetes/ingress-nginx

I've upgraded from 0.9.0-beta5 to beta 7 and I don't see any X-Real-IP or X-Forwarded-For-Header anymore.

beta5:

Host: hostname.foo
X-Real-IP: 79.192.218.180
X-Forwarded-For: 79.192.218.180, 79.192.218.180
X-Forwarded-Host: hostname.foo
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Original-URI: /
X-Scheme: https

beta 6/7:

Host: hostname.foo
X-Forwarded-Host: hostname.foo
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Original-URI: /
X-Scheme: https

SSL is terminated by an AWS ELB. No proxy protocol is used.

Most helpful comment

I am working in adding e2e test to the ingress controller in order to avoid all this regressions we are having. https://github.com/kubernetes/ingress/pull/801

All 11 comments

I am working in adding e2e test to the ingress controller in order to avoid all this regressions we are having. https://github.com/kubernetes/ingress/pull/801

I believe this is the change that caused the issue.

If you set X-Forwarded-Proto to https those map statements make it so that X-Forwarded-For and X-Real-IP are passed down to the backends only if you have the backends using proxy-protocol (see "use proxy-protocol" here), because without it the value of $proxy_protocol_addr will be empty. In my opinion if the header is already present and it matches with the trusted addresses it shouldn't be overwritten like that.

I am using quay.io/aledbf/nginx-ingress-controller:0.132 and seem to get X-Real-IP alright.

@weitzj negative, I can't confirm that. I tried, and passing X-Forwarded-Proto: https still results in both X-Forwarded-For and X-Real-IP being swallowed with that image. Which makes sense since the map statements haven't been touched: https://github.com/kubernetes/ingress/compare/nginx-0.9.0-beta.7...master#diff-b7803798d356c6c17a90d93cc58bdbaa

@totallyunknown please update the image to quay.io/aledbf/nginx-ingress-controller:0.148
Fix in https://github.com/kubernetes/ingress/pull/890

Closing. Please reopen if you still have issues

Thanks. It's working with quay.io/aledbf/nginx-ingress-controller:0.148. But it looks like, the fix is not included in 0.9.0-beta-9?

Thanks, I've took a look into the Changelog and #890 isn't listed - that why I was asking.

@totallyunknown sorry, the issues are not sorted https://github.com/kubernetes/ingress/pull/905/files#diff-2b00570d6a55cbb418bfb30203d59114R25

Was this page helpful?
0 / 5 - 0 ratings