Expand description
Traffic mirroring / shadowing middleware.
Sends a copy of traffic to a secondary backend (fire-and-forget, response discarded). Useful for testing new backend versions, benchmarking, or audit recording.
§Configuration
[[backends]]
name = "api"
transport = "http"
url = "http://api.internal:8080"
[[backends]]
name = "api-v2"
transport = "http"
url = "http://api-v2.internal:8080"
mirror_of = "api" # mirror traffic from "api" backend
mirror_percent = 10 # mirror 10% of requests§How it works
- Request arrives targeting
api/search - Primary response is returned from the
apibackend as normal - A copy of the request is rewritten to
api-v2/searchand sent fire-and-forget to theapi-v2backend - The mirror response is discarded; errors are logged but don’t affect the primary response
Structs§
- Mirror
Layer - Tower layer that produces a
MirrorService. - Mirror
Service - Traffic mirroring middleware.