How to mirror and do a URLRewrite at the same time?

Hi, I’m trying to use a URL rewrite on a mirrored request, and can’t work out how to configure this. Has anyone done this or knows how to do it?

I’m using the Gateway API, but I think it should be similar for either API option.

Currently, I have an HTTPRoute that looks like this:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: webhook-server
spec:
  parentRefs:
    - name: gateway
      namespace: gateway-namespace
  hostnames: ["example-webhook.example.com"]
  rules:
    - matches:
        - path:
            value: "/api/webhook"
      backendRefs:
        - name: main-server
          port: 80
      # send webhooks to another couple of servers as well
      filters:
        - type: RequestMirror
          requestMirror:
            backendRef:
              name: webhook-server-2
              port: 7000
        # and to another server (this one needs a URL rewrite)
        - type: RequestMirror
          requestMirror:
            backendRef:
              name: webhook-server-3
              # ReferenceGrant in server-3 namespace
              namespace: server-3
              port: 8080

    - backendRefs:
        # everything else just goes to the main server
        - name: main-server
          port: 80

I have tried adding this in-mesh route for the URL rewrite on one of the mirrored backends, but it doesn’t seem to do anything!

apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: server-3-mesh-traffic
  namespace: server-3
spec:
  parentRefs:
    - group: ""
      kind: Service
      name: server-3
  rules:
    - filters:
        - type: URLRewrite
          urlRewrite:
            path:
              type: ReplaceFullPath
              # send everything to the webhook url
              replaceFullPath: /api/another/webhook/url
      backendRefs:
        - name: server-3
          port: 8080