Hi team,
I’d appreciate any help with this. Thank you!
In my traefik configuration, we’re using a request mirroring setting to send a request also to a secondary service. Is there any way to disable the mirroring when the primary service is temporary unavailable?
The reason is, when the primary service is unavailable, traefik responds back to the client with a 503, the clients then retries the request. Unfortunately this retry is mirrored as a new request to the secondary service (to which the mirrored requests go to) and ends up as a duplicate request for each retry.
My configuration looks like this:
http:
routers:
https_router:
entryPoints:
- websecure
rule: "PathPrefix(`/`)"
service: hfs
tls: {}
services:
hfs:
mirroring:
service: domain-hf
maxBodySize: -1
mirrors:
- name: cloud-hf
percent: 100
domain-hf:
loadBalancer:
serversTransport: main
healthCheck:
path: /services/collector/health
interval: "10s"
timeout: "3s"
responseForwarding:
flushInterval: 1s
passHostHeader: true
servers:
- url: "https://domainhf:6088/"
cloud-hf:
loadBalancer:
serversTransport: main
healthCheck:
path: /services/collector/health
interval: "10s"
timeout: "3s"
responseForwarding:
flushInterval: 1s
passHostHeader: true
servers:
- url: "https://cloudhf:5088/"
serversTransports:
main:
insecureSkipVerify: true
disableHTTP2: true
tls:
certificates:
- certFile: /traefik/certs/traefik.crt
keyFile: /traefik/certs/traefik.key
This is an example log message returned by traefik when the primary service (domain-hf in this case) is unavailable:
172.21.0.5 - - [10/Oct/2024:21:38:16 +0000] "POST /services/collector/event/1.0 HTTP/1.1" 503 20 "-" "Go-http-client/1.1" 22 "https_router@file" "-" 0ms
Any way to prevent this duplication? or prevent mirroring when the primary service is unavailable?
Thank you!