Skip to content

RequestMirror silently fails when HTTPRoute is configured with a filter with direct response #7473

@zhaohuabing

Description

@zhaohuabing

Description:

When a HTTPRoute is configured with both RequestMirror and DirectResponse, the requestMirror doesn't work, and no errors in the status or envoy gateway log.

MirrorPolicy shouldn't be configured with DirectResponse because only one of route(RouteAction), redirect, direct_response can be set for Envoy route component, and RequestMirrorPolicies is inside the routeAction.

We should surface an error message to the HTTPRoute status and set Accepted as False.

Repro steps:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: mirror-with-direct-response
spec:
  parentRefs:
  - group: gateway.networking.k8s.io
    kind: Gateway
    name: eg
  rules:
  - filters:
    - requestMirror:
        backendRef:
          group: ""
          kind: Service
          name: backend
          port: 3000
      type: RequestMirror
    - extensionRef:
        group: gateway.envoyproxy.io
        kind: HTTPRouteFilter
        name: filter-direct-response
      type: ExtensionRef
    matches:
    - path:
        type: PathPrefix
        value: /
status:
  parents:
  - conditions:
    - lastTransitionTime: "2025-11-10T06:23:01Z"
      message: Route is accepted
      observedGeneration: 1
      reason: Accepted
      status: "True"
      type: Accepted
    - lastTransitionTime: "2025-11-10T06:23:01Z"
      message: Resolved all the Object references for the Route
      observedGeneration: 1
      reason: ResolvedRefs
      status: "True"
      type: ResolvedRefs
    controllerName: gateway.envoyproxy.io/gatewayclass-controller
    parentRef:
      group: gateway.networking.k8s.io
      kind: Gateway
      name: eg
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: HTTPRouteFilter
metadata:
  name: filter-direct-response
spec:
  directResponse:
    statusCode: 404

Generated xds Route:

      routeConfig:
        '@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration
        ignorePortInHostMatching: true
        name: default/eg/http
        virtualHosts:
        - domains:
          - '*'
          metadata:
            filterMetadata:
              envoy-gateway:
                resources:
                - kind: Gateway
                  name: eg
                  namespace: default
                  sectionName: http
          name: default/eg/http/*
          routes:
          - directResponse:
              status: 404
            match:
              prefix: /
            metadata:
              filterMetadata:
                envoy-gateway:
                  resources:
                  - kind: HTTPRoute
                    name: mirror-with-direct-response
                    namespace: default
            name: httproute/default/mirror-with-direct-response/rule/0/match/0/*

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions