We have recently upgraded from Traefik v1.7.20 to v.2.9.6. We have been using the annotation "ingress.kubernetes.io/rewrite-target: / " and since this is no longer supported in Traefik v2, we are moving towards middlewares specifically stripprefixregex. Below is the configuration.
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: abc-stripprefixregex
spec:
stripPrefixRegex:
regex:
- "/abc/[a-z,-]+/"
- "/abc/ht/[a-z,-]+/"
- "/abc/[a-z,-]+"
And we are using this middleware as an annotation in the kubernetes ingress. The issue we are facing is that it is only working when we are using the trailing slash in the URL. For example.
Working : https://www.example.com/abc/xyz/
Working : https://www.example.com/abc/ht/xyz/
Not working : https://www.example.com/abc/xyz --- 404 Not found
Can I anyone tell what could I be missing here?