Hi Team,
I have a requirement to replace the path from '/monitoring' to '/' before forwarding to the service. But it is not working as expected. '/monitoring' is forwading to the service and for '/' we are getting 404.
Traefik Middleware
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: replace-path
spec:
replacePath:
path: /
Traefik ingressroute
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: prometheus-ingroute
spec:
entryPoints:
- web
routes:
- kind: Rule
match: PathPrefix(`/monitoring`)
middlewares:
- name: replace-path
namespace: acs
services:
- name: prometheus-service
namespace: monitoring
port: 9090
Traefik logs
10.25.134.144 - - [22/Aug/2023:12:57:26 +0000] "GET /monitoring HTTP/1.1" 302 29 "-" "-" 3036 "platform-prometheus-ingroute-aefcecd63388ac21cfa5@kubernetescrd" "http://192.168.27.74:9090" 0ms
10.25.134.144 - - [22/Aug/2023:12:57:26 +0000] "GET /graph HTTP/1.1" 404 19 "-" "-" 3037 "-" "-" 0ms
When we are hitting 'traefik IP:port/monitoring' from browser it is redirecting to the POD but when it is replacing the path to 'traefik IP:port/' it is not redirecting to POD.
Am I doing something wrong here? Do we need to create the middleware in the same namespace where service is running or it is independent of namespace?