Unable get replacePathRegex working in k8s

Hi,
I am new to traefik and trying to use it in k8s. We have to use traefik as kubernetesIngress and cannot use the IngressRoute.

Problem Statement:
Whenever a request path comes as "/abc" I want the path to become "/xyz/Ping".

  1. I have the following middlewae setting in the dynamic config file.

    test-replacepathregex:
    replacePathRegex:
    regex: "/abc"
    replacement: "/xyz/Ping"

  2. The Ingress object has the annotation

traefik.ingress.kubernetes.io/router.middlewares: test-replacepathregex@file

  1. If I make direct call to /xyz/Ping it works, so I know my backend is good.

  2. Now when I make request with /abc, I immediately get a 404 from traefik. Access log shows that traefik is returning the 404 and not sending /xyz/Ping to the backend.

Am I missing some configurations? Any help is appreciated.

Note: I want to use regex as my real life problem is more complicated and will need regex, here I am posting a simpler version of my problem.

Thanks,
PB