-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add use-forwarded-headers configmap option. #1851
Conversation
ping @maxlaverse |
Hi @Dirbaio, |
Yes! It's all tested, I'm actually using it in production :) If by "broken" you mean the "dummy" thing, it's the only workaround I could find to assign one variable to another in the For example, this sets the variable $pass_access_scheme to the value of $scheme unconditionally.
I agree it's rather ugly, I'd love input on better ways to do this. Some things I've tried:
Also note that the original template before my changes already had one instance of such hack: the map for |
Rebased to latest master |
Thanks for the explanation @Dirbaio As I said I like the idea. However I have the impression this PR makes the code around the My opinion is that we should spend time on your last comment in #1815 (comment), see what can technically be done and agree on a clear implementation for the |
This PR implements mostly the behavior in that comment.
Maybe it would be cleaner to replace these two bools with a single option choosing the mode. Something like this?
Not sure on the naming though. And of course, document it. What do you think? |
I don't have a strong opinion about the naming. I think a mixed setup with forwarded headers and proxy protocol is broken anyway and can't be fixed (see #1489 (comment)) Now that I spent some time reading your proposition, I think those dummy maps are acceptable (if we can't find a cleaner way). At least it makes the proxy configuration easier to understand for users. We should make sure we have the rights comments in the template to make it easier for contributors to understand how the Nginx Controller works with the different "proxy-mode"s. Let's discuss #1815 (comment) and if we reach an agreement, add documentation here ? |
@Dirbaio we need to try to not add new options. I mean
|
There's no other way to do this. |
@@ -205,6 +202,26 @@ http { | |||
default $http_x_forwarded_host; | |||
'' $this_host; | |||
} | |||
{{ else }} | |||
map 'dummy' $pass_access_scheme { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment at the start of the else section explaining why this is required
I agree that in general we should always try limiting the addition of new options. Don't you think it's really easier to explain how the Nginx Ingress works with those "proxy-modes" @aledbf ? And having the documentation talking about proxy modes that match the configuration flags is straightforward to understand, which should lead to less issues on the topic :) If we have a proper section in the documentation about those modes including the existing |
Good idea |
You think the explanation in #1815 (comment) is the right format? |
I think we could start from it yes The source of the headers is described for every case. The existing |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
This PR adds a configmap option
use-forwarded-headers
to enable/disable trust of incomingX-Forwarded-*
headers.It is set to
true
by default, which corresponds to the current ingress behavior, so this change is backwards compatible.Fixes #1815 #1309 #1668