-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Data proxy: Fix encoded characters in URL path should be proxied as encoded #30597
Conversation
pkg/api/dataproxy.go
Outdated
var proxyPathRegexp = regexp.MustCompile("^\\/api\\/datasources\\/proxy\\/[\\d]+\\/?") | ||
|
||
func getProxyPath(originalRawPath string) string { | ||
return proxyPathRegexp.ReplaceAllString(originalRawPath, "") |
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.
Can you just move the call to ensureProxyPathTrailingSlash
here, is there any need to require the caller to take care of this? Benefit would be more of the code covered by the tests.
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.
@domasx2 pointed out that ensureProxyPathTrailingSlash is no longer needed. Please have a look again
It is still not working but thank you very much for picking this up. In here https://github.com/grafana/grafana/blob/master/pkg/api/pluginproxy/ds_proxy.go#L101 |
I tested this a bit, and seems that now the slash gets escape twice 😞 Eg if you set |
I'll have a look and see if I can resolve these problems again |
@zoltanbedi @domasx2 can you please help out testing this out and/or provide some way to easily verify my changes. I tried to use the docker/blocks/slow_proxy, but with my changes and trying to include escaped slash doesn't arrive at the slow proxy 😕 |
I think I might be able to verify using the jaeger docker block... |
@zoltanbedi @domasx2 Using jaeger with a service named |
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.
Thank you @marefr lgtm.
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Works for me as well, thanks @marefr 👍 |
…ded (grafana#30597) Fix encoded characters in URL path should be proxied as encoded in the data proxy. Fixes grafana#26870 Fixes grafana#31438 Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
What this PR does / why we need it:
Fix encoded characters in URL path should be proxied encoded in data proxy.
Which issue(s) this PR fixes:
Fixes #26870
Fixes #31438
Special notes for your reviewer:
Is it viable to replace
c.Params("*")
with a replace of the raw URL path?