Skip to content
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 proxy-set-headers annotation for ingress #5366

Merged
merged 100 commits into from
Apr 15, 2024

Conversation

AlexFenlon
Copy link
Contributor

@AlexFenlon AlexFenlon commented Apr 9, 2024

Proposed changes

This adds the nginx.org/proxy-set-headers annotation to ingress.
As shown in option 1 in the issue, It can be used to set a custom header by setting the annotation by doing nginx.org/proxy-set-headers: "X-Forwarded-ABC"

It can also allow multiple headers by doing nginx.org/proxy-set-headers: "X-Forwarded-ABC,ABC2"

It also allows the user to set a custom value in the annotation by doing nginx.org/proxy-set-headers: "X-Forwarded-ABC: test"

It can be used in Minion and Master, as well in a non mergable/standard ingress.
The annotation set in minion, if it has the same header name eg. X-Forwarded-ABC, but different value, minion will override the master

If there are different headers in both master and minions, both master and the minion annotations will show up.

There are pytests and go tests for this functionality.

Resolves: #4772

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Signed-off-by: AlexFenlon <a.fenlon@f5.com>
Copy link
Contributor

@shaun-nx shaun-nx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done @AlexFenlon ! 👏

Copy link
Contributor

@jjngx jjngx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@AlexFenlon AlexFenlon merged commit b047d51 into main Apr 15, 2024
77 checks passed
@AlexFenlon AlexFenlon deleted the feat/proxy-set-header-annotation branch April 15, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Pull requests for new features/feature enhancements tests Pull requests that update tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add ability to pass X-Forwarded-* headers unchanged to upstream
6 participants