packruler / rewrite-body

Traefik Plugin to allow regex replacement of HTTP GET response body
Apache License 2.0
23 stars 9 forks source link

Path filter #20

Open muratcorlu opened 8 months ago

muratcorlu commented 8 months ago

Describe the solution you'd like It would be great to be able to replacement for a specific path prefix without needing to define a new traefik router.

services:
  mysite:
    ...
    labels:
      traefik.http.middlewares.my-injector.plugin.rewritebody.rewrites[0].regex: </body>
      traefik.http.middlewares.my-injector.plugin.rewritebody.rewrites[0].pathPrefix: /admin
      traefik.http.middlewares.my-injector.plugin.rewritebody.rewrites[0].replacement: <script src="admin-analytics.js"></script></body>
      traefik.http.routers.mysite.rule: Host(`mysite.com`)
      traefik.http.routers.mysite.service: mysite

Describe alternatives you've considered I think this is currently possible by creating a separate route definition that points same service. But that add too much repeating and crowd.

packruler commented 5 months ago

Hey @muratcorlu! Sorry for the lack of updates on this request! It's been a really hectic year for me but I will poke at this a bit in the coming days. I am not guaranteeing an implementation but I will do my best to give more timely updates 😁