-
Notifications
You must be signed in to change notification settings - Fork 25.7k
SQL: fix URI path being lost in case of hosted ES scenario #44776
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
Conversation
|
@elasticmachine run elasticsearch-ci/packaging-sample |
matriv
left a comment
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
For completeness I would add a test with null segment and tests with null and empty uri.
| concatenatedPath = path + "/" + cleanSegment; | ||
| } | ||
| try { | ||
| return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), concatenatedPath, |
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.
Why not using new URI(concatenatedPath) ?
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.
Because concatenatedPath is only the uri.getPath() section of the initial URI. If one has http://localhost:9200/es_rest/ path is /es_rest/. And this method's purpose is to add a new segment to the already existent path: http://localhost:9200/es_rest/ + /_sql for example.
(cherry picked from commit 06dea85)
(cherry picked from commit 06dea85)
(cherry picked from commit 06dea85)
(cherry picked from commit 06dea85)
URI.resolve()method doesn't work as we intended it to work and when an URI of the formhttp://localhost:8080/custom_path/is being used (common in reverse proxy scenarios), theresolve("/_sql")(very common path resolve) call will strip thecustom_pathfrom the URI and just put/_sqlinstead. Whereas the desired behavior should be appending the additional segment to the existent URI and creating thehttp://localhost:8080/custom_path/_sqlURI.This PR fixes #44721.