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

docs: requestHeaderPolicy example in Request Rewriting documentation #6805

Open
arosh opened this issue Dec 10, 2024 · 1 comment
Open

docs: requestHeaderPolicy example in Request Rewriting documentation #6805

arosh opened this issue Dec 10, 2024 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor.

Comments

@arosh
Copy link

arosh commented Dec 10, 2024

What steps did you take and what happened:

I found a potentially incorrect YAML example in the documentation at https://projectcontour.io/docs/main/config/request-rewriting/#manipulating-the-host-header

The current example shows requestHeaderPolicy as a separate route element:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: static-host-header-rewrite-route
spec:
  fqdn: local.projectcontour.io
  routes:
    - conditions:
      - prefix: /
      services:
        - name: s1
          port: 80
    - requestHeaderPolicy:
        set:
        - name: host
          value: foo.com

What did you expect to happen:

I believe requestHeaderPolicy should be part of the same route element, not a separate one. The correct YAML should be:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: static-host-header-rewrite-route
spec:
  fqdn: local.projectcontour.io
  routes:
    - conditions:
      - prefix: /
      services:
        - name: s1
          port: 80
      requestHeaderPolicy:
        set:
        - name: host
          value: foo.com

Here's the diff showing the change:

 routes:
   - conditions:
     - prefix: /
     services:
       - name: s1
         port: 80
-  - requestHeaderPolicy:
+    requestHeaderPolicy:
       set:
       - name: host
         value: foo.com

The current example would likely not work as intended because it shows requestHeaderPolicy as a separate route element without any conditions or services. While this might be valid YAML syntax, it would not achieve the expected header rewriting behavior.

Anything else you would like to add:

Could you please confirm if this is indeed a documentation error? If my understanding is correct, the current example might be misleading for users.

Environment:

N/A (Documentation issue)

@arosh arosh added kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Dec 10, 2024
Copy link

Hey @arosh! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor.
Projects
None yet
Development

No branches or pull requests

1 participant