I have a vertx app which sends the request to a proxy. It uses HttpClient with setproxyoptions. Then form a request using request options to set the actual host, port, method and path.
Vertx version: 4.4.0
public class MainVerticle extends AbstractVerticle {
@Override
public void start() throws InterruptedException {
HttpClientOptions options = new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2)
.setForceSni(false)
.setProxyOptions(new ProxyOptions().setHost("172.16.10.17").setPort(8080).setType(ProxyType.HTTP))
.setHttp2ClearTextUpgrade(false);
RequestOptions requestOptions = new RequestOptions()
.setHost("127.0.0.1")
.setPort(8080)
.setMethod(HttpMethod.GET)
.setURI("/nudr-dr/v1/subscription");
HttpClient client = vertx.createHttpClient(options);
client.request(requestOptions)
.compose(request -> request.send().compose(response -> response.body()))
.onSuccess(body -> System.out.println("HTTP/2 client received body: " + body.toString()))
.onFailure(error -> System.out.println("HTTP/2 client error: " + error.getCause() + error.getStackTrace()));
}
}
I expected to send the message something like below:
TCP/IP
scr: 172.10.1.5:8080
dest: 172.16.10.17:8080
HTTP2
:method: GET
:path: /nudr-dr/v1/subscription
:scheme: http
:authority: localhost
but the message was carrying the path prefixed with scheme and authority information :path: http://localhost/nudr-dr/v1/subscription
Note: This issue is not observed when the request is sent to the actual destination without setting the proxy option in HttpClient.
Why it is duplicating scheme and authority in path thought scheme and authority is mandatory and present in the request? Is this expected when it comes to proxy?