Conversation
|
Pinging @elastic/es-core-infra |
|
We have discussed this in the past, and if I remember correctly we said we are not in favor of modifying the request by adding That said I am closing this PR, but thanks a lot for opening it, and hopefully you will find some other improvement to work on ;) |
|
I've done some more digging, and I would like to discuss this further if that's OK? I believe the current position is inconsistent. In RestClientBuilder.setPathPrefix, there is the following code: ie paths are forced to have a leading slash. There is also this: ie you cannot simply handle the trivial case of "always prepend a slash" because the code actually doesn't let you. As far as I can tell, there is no correct use case for the user providing a relative path URI without a pathPrefix. If we don't automatically fix this error (per the fix I suggested) then we should throw an exception with advice that either a pathPrefix or a leading slash is required. |
This is a trivial change which ensures the user has a leading slash on the URI.
As currently written, the user can pass a request without a slash. Without this, the request is not strictly valid according to the HTTP spec. Nonetheless, requests to ES still work, but requests via an AWS ELB/ALB fail.