Skip to content

Precedence not given to Exact headers #5736

Open
@mattbrandman

Description

@mattbrandman

Description:

What issue is being seen? Describe what should be happening instead of
the bug, for example: The expected value isn't returned, etc.
When all other things are equal but header matches are exact and regex there does not appear to be any specific precedence given to the exact match
Repro steps:
Include sample requests, environment, etc. All data and inputs
required to reproduce the bug.

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: server

spec:
  parentRefs:
    - name: gateway
      namespace: envoy-gateway
  hostnames:
    - test.backend.com
  rules:
  - backendRefs:
    - name: server
    matches:
      - headers:
        path:
          type: PathPrefix
          value: /
          - name: x-org-id
            value: test-org
            type: Exact
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: server

spec:
  parentRefs:
    - name: gateway
      namespace: envoy-gateway
  hostnames:
    - test.backend.com
  rules:
  - backendRefs:
    - name: server
    matches:
      - headers:
         path:
            type: PathPrefix
            value: /
            - name: x-org-id
              value: .*
              type: RegularExpression

Would expect top to match when org is test-org but it does not seem to be determinate or to be falling back to earliest / alphabetical at times.

My current workaround is basically redeclaring the header twice on the non-regex so the Largest number of headers match applies first to it

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions