Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReplacePath rule executes out of order, when combined with PathPrefixStrip #1569

Closed
aantono opened this issue May 9, 2017 · 1 comment
Closed
Labels
Milestone

Comments

@aantono
Copy link
Contributor

aantono commented May 9, 2017

I believe I found a possible bug, or at least a not intuitive behavior when ReplacePath rule is preceded by PathPrefixStrip
Basically because PathPrefixStrip is a Matcher, but also happens to be a Modifier as well, when combined with ReplacePath, like PathPrefixStrip:/management;ReplacePath:/health, due to the order in which the Modifiers are applied in server.go, the above rule-set does not behave as expected.

While one would expect that we match the request to /management url, strip the /management prefix, followed by a replace with /health. This is NOT, however, what is happening. The matcher does the job correctly and matches the request on /management and sends it down the correct Handler chain, but that's when the issue creeps in.

Because ReplacePath Modifier gets executed first in the Handler chain, it replaces /management with /health, and when StripPrefix Modifier gets called, it is trying to match the Path with /management prefix, and obviously failing to do so, thus returning 404-Not Found.

If the Rule is written as PathPrefixStrip:/management;ReplacePath:/management/health, then everything works, but the actual invocation URL Path ends up being NOT /management/health but /health, thus making this configuration be misleading.

This issue relates to #1374

@ldez ldez added the kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. label May 9, 2017
aantono added a commit to aantono/traefik that referenced this issue May 12, 2017
@timoreimann timoreimann added kind/bug/confirmed a confirmed bug (reproducible). and removed kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. labels May 15, 2017
aantono added a commit to aantono/traefik that referenced this issue May 15, 2017
@ldez
Copy link
Member

ldez commented May 15, 2017

Closed by #1577

@ldez ldez closed this as completed May 15, 2017
@ldez ldez added this to the 1.3 milestone May 16, 2017
m3co-code pushed a commit to m3co-code/traefik that referenced this issue Aug 22, 2017
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants