Hi everyone,
I have configured multiple Traefik Ingress resources for the same host: one handling the / path prefix and another handling /api. Each Ingress points to a different service:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: a
spec:
ingressClassName: traefik
rules:
- host: "example.com"
http:
paths: - path: /api
pathType: Prefix
backend:
service:
name: a
port:
number: 9090
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: b
spec:
ingressClassName: traefik
rules:
- host: "example.com"
http:
paths: - path: /
pathType: Prefix
backend:
service:
name: b
port:
number: 8080
When the pod behind service a is running properly, requests to /api are handled as expected. However, when that pod becomes unavailable or unhealthy, requests to /api/... are routed to service b (the / path) instead of returning an error.
As far as I understand, this might be default behavior, but I would prefer Traefik to return a 503 Service Unavailable response (or a similar error) when the /api backend is not available, rather than falling back to another service.
Is there a way to configure Traefik to achieve this behavior?