How to edit or rewrite headers using regex?

Is there a way to edit a header in request and response via regex?

I would like to accomplish this Expose the server in a subfolder | MediaMTX using traefik instead of those listed in the article.

Is traefik capable of this?

If I undertsand the requirements correctly, you can use Traefik and match with PathPrefix() in rule and remove a part of the path with stripPrefix middleware when proxying/forwarding the request, but I don't think it's possible to prefix a header in the response.

You can look at the plugins or create your own one. Or create a feature request, but that's probably not high on their priority list.