Skip to content

docs: requestHeaderPolicy example in Request Rewriting documentation #6805

Open
@arosh

Description

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)

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/needs-triageIndicates that an issue needs to be triaged by a project contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions