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
Fix raw path handling in strip prefix #2382
Fix raw path handling in strip prefix #2382
Conversation
We ran into the problem this PR fixes in our internal infrastructure and validated that the code change fixes things. Is that good enough to classify the PR as |
Seems related to containous/oxy#30 |
@ldez those issues are not related. |
462d00d
to
b7c31e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b7c31e8
to
d6036a1
Compare
@marco-jantke do you think that fixing #1957 could be somewhat similar? That issue has been around for a while. |
This PR fixes forwarding of URL encoded characters to the backend servers.
Given that Traefik receives a request path in the form:
/some/a%2Fb
it should forward the same path to the backend. This is the case when using e.g. the rule typePathPrefix
, but as soon as the rule type is eitherPathPrefixStrip
orPathPrefixStripRegex
the path was forwarded in the decoded form like:/some/a/b
.The reason why this solution fixes our problem is that go uses the
String()
method of theURL
object when it constructs the request. The docs state for this:For us the relevant part is with
u.EscapedPath()
and there the docs state:To understand the problem, note the sentence:
EscapedPath returns u.RawPath when it is a valid escaping of u.Path.
By stripping only the Path and not the RawPath we violated this statement and therefore the http package decided to use thePath
.