Skip to content

HTTPBackendRef URLRewrite path filter is accepted but omitted from generated Envoy route config #9095

Description

@aneesh-wolt

Summary

URLRewrite path filters under backendRefs[].filters are accepted on an HTTPRoute, but the generated Envoy route config does not include the rewrite. The backend receives the original path.

Moving the same URLRewrite to rule-level rules[].filters works and generates the expected Envoy regex_rewrite / prefix_rewrite.

Environment

  • Envoy Gateway release: v1.7.0
  • Kubernetes Gateway API: v1.4.1
  • Envoy proxy from config dump: 1.37

Reproducer

BackendRef-level rewrite, exact path:

- matches:
    - path:
        type: Exact
        value: /rewrite/url/exact
  backendRefs:
    - name: http-echo-doc
      port: 80
      filters:
        - type: URLRewrite
          urlRewrite:
            path:
              type: ReplaceFullPath
              replaceFullPath: /modified/url/rewrite/url/exact

BackendRef-level rewrite, prefix path:

- matches:
    - path:
        type: PathPrefix
        value: /rewrite/url/path-prefix
  backendRefs:
    - name: http-echo-doc
      port: 80
      filters:
        - type: URLRewrite
          urlRewrite:
            path:
              type: ReplacePrefixMatch
              replacePrefixMatch: /replaced-prefix

Observed behavior

The route is accepted, but generated Envoy config has no rewrite fields.

Non-working exact path route shape:

"match": {
  "path": "/rewrite/url/exact"
},
"route": {
  "weighted_clusters": {
    "clusters": [
      {
        "name": ".../rule/2/backend/0",
        "weight": 1
      }
    ]
  }
}

Non-working prefix path route shape:

"match": {
  "path_separated_prefix": "/rewrite/url/path-prefix"
},
"route": {
  "weighted_clusters": {
    "clusters": [
      {
        "name": ".../rule/3/backend/0",
        "weight": 1
      }
    ]
  }
}

Live curl confirms the backend still sees the original path:

  • /rewrite/url/exact
  • /rewrite/url/path-prefix/my/path

Expected behavior

Either:

  1. BackendRef-level URLRewrite should be translated into Envoy route rewrite config, or
  2. If backendRef-level URLRewrite is unsupported, the HTTPRoute should not be accepted silently; status should indicate the unsupported/incompatible filter.

Working comparison

When the same rewrite is moved to rule-level rules[].filters, Envoy config includes the expected rewrite.

Working exact path route shape:

"match": {
  "path": "/rewrite/url/exact"
},
"route": {
  "cluster": ".../rule/2",
  "regex_rewrite": {
    "pattern": {
      "regex": "^/.*$"
    },
    "substitution": "/modified/url/rewrite/url/exact"
  }
}

Working prefix path route shape:

"match": {
  "path_separated_prefix": "/rewrite/url/path-prefix"
},
"route": {
  "cluster": ".../rule/3",
  "prefix_rewrite": "/replaced-prefix"
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions