Copy of prod container with dev domain (wordpress)

I have a docker-compose with a wordpress container behind a traefik proxy and serve it under domain.

I have a copy of the same container on another server (same traefik config). I can change my local hosts file to access the second site as dev container for tests and dev. But I want to solve it with a traefik rule.

I tried replacepathregex:

  • "traefik.http.middlewares.test-replacepathregex.replacepathregex.regex=(dev\.)(example\.com)"
    - "traefik.http.middlewares.test-replacepathregex.replacepathregex.replacement=$$2"

First access to works, but wordpress redirects to example.local (because of the siteurl?

Yes, I have a solution with replacing all the references in the container and serve the hole container with a new domain ... but to change from prod to dev and dev to prod .... there are too many steps to not break the wordpress installation ...

Is there a router/middleware that takes the url (dev.example.local) and forwards the request to the container (running as example.local), gets the response, replace the with and serves it back? So that the wordpress container not knowing that it runs under a different domain?