Skip to content

Incorrect validation or description for HTTPHeaderFilter in HTTPRoute #3407

Closed
@snorwin

Description

@snorwin

What happened:
The current documentation for the HTTPHeaderFilter type in the HTTPRoute Custom Resource (CR) specifies the validation rules as follows:

Only one action for a given header name is permitted. Filters specifying multiple actions of the same or different type for any one header name are invalid and will be rejected by CRD validation.

However, this description does not accurately reflect the actual validation behavior:

  • Filters specifying multiple actions of the same or different type for any one header name are invalid:

    requestHeaderModifier:
      add:
        - name: my-header-name
          value: my-header-value
        - name: my-header-name
          value: my-header-value
    

    Error: The HTTPRoute "backend" is invalid: spec.rules[0].filters[0].requestHeaderModifier.add[1]: Duplicate value: map[string]interface {}{"name":"my-header-name"}

  • Filters specifying multiple actions of the same or different type for any one header name are invalid:

    requestHeaderModifier:
      add:
        - name: my-header-name
          value: my-header-value
      set:
        - name: my-header-name
          value: my-header-value
    

    No Error: httproute.gateway.networking.k8s.io/backend configured

What you expected to happen:
The documentation should accurately describe the validation rules. If multiple actions of different types are indeed permitted for the same header, this should be clearly stated in the documentation. Otherwise, if the current behavior is unintended, the validation logic should be updated to match the documented behavior.

How to reproduce it (as minimally and precisely as possible):
Define an HTTPRoute with the requestHeaderModifier mentioned above.

Anything else we need to know?:
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions