I am trying to make a connection to a 3rd party API that requires an api key. It works fine using traditional HttpURLConnection... I get a 200 response
HttpURLConnection connection = (HttpURLConnection) new URL("https://www.server.com/download?apikey=<MY_KEY>"
However when using the Vertx WebClient (io.vertx.ext.web.client.WebClient) I always get 403 Forbidden
webClient = WebClient.create(vertx, new WebClientOptions());
webClient.get("/download")
.addQueryParam("apikey", "<MY_KEY>")
.ssl(true)
.host("www.server.com")
.port(443)
.send(downloadFileHandler ->
{
Upon investigation it looks like the reason is because the API is redirecting to another URL, both the original URL and the redirect are using SSL. Somehow the Vertx web client is not maintaining the handshake.