PathPrefixStrip tedious

Hi again,

As I mentioned in another topic, I'm currently migrating a v1 configuration to a v2 one.
I like a lot the new structure of the configuration which makes more sense to me (routers, services, middlewares ...).

Currently my main complaint is that doing the equivalent of v1's PathPrefixStrip is quite tedious, if I understood correctly you have to create a new middleware for every service that needs a strip + declare that you want to use it in that service. You also have to use a unique name for that middleware. (btw all prefixes are different so no sharing is possible)

This is pretty tedious compared to v1 when you have many services that use Strip.
I understand that having this kind behaviour in a separate middleware is clean in terms of code but it's pretty hard to use when creating services.

Don't we need a shortcut?

Cheers,
Pierre

Hi @piec, in v2, it's because of the new model, where the responsibilities are clear and separated (it's not only a matter of code, but also of end user having a better understanding of what they are doing): https://docs.traefik.io/v2.0/routing/overview/#clear-responsibilities .

Matching a routing rule and modifying a request are 2 different tasks, and mixing both in a PathPrefixStrip created a lot of confusion for newcomers in the path.

The choice of "less configuration item vs. more powerful abilities and understanding" is quite clear in v2.0.

However, it is interesting what you are mentioning: do you feel the documentation or a guide should be written to show a "migration" path to avoid falling into this "tedious" behavior, providing "off-the-shelf" example? If yes, where would you expect to see such an indication? Would you be willing to help contributing on this documentation matter?

1 Like