[go: nahoru, domu]

Skip to content

HTTP request mirroring

Extended Support Feature

As of v1.0.0, the Request Mirroring feature is an Extended feature, and requires implementations to support the HTTPRouteRequestMirror feature.

The HTTPRoute resource allows you to mirror HTTP requests to another backend using filters. This guide shows how to use this feature.

Mirrored requests will must only be sent to one single destination endpoint within this backendRef, and responses from this backend MUST be ignored by the Gateway.

Request mirroring is particularly useful in blue-green deployment. It can be used to assess the impact on application performance without impacting responses to clients in any way.

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-filter-mirror
  labels:
    gateway: mirror-gateway
spec:
  parentRefs:
  - name: mirror-gateway
  hostnames:
  - mirror.example
  rules:
  - backendRefs:
    - name: foo-v1
      port: 8080
    filters:
    - type: RequestMirror
      requestMirror:
        backendRef:
          name: foo-v2
          port: 8080

In this example, all requests are forwarded to service foo-v1 on port 8080, and they are also forwarded to service foo-v2 on port 8080, but responses are only generated from service foo-v1.