Skip to content

Commit f2abec3

Browse files
authored
Rest: configure HTTP/1.1 version as default for client instead of request (#47)
1 parent 6913410 commit f2abec3

File tree

1 file changed

+4
-2
lines changed
  • src/main/java/io/github/jopenlibs/vault/rest

1 file changed

+4
-2
lines changed

src/main/java/io/github/jopenlibs/vault/rest/Rest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ private HttpClient getClient() {
423423
if (configuredClient != null) {
424424
return configuredClient;
425425
}
426-
final var client = HttpClient.newBuilder();
426+
final var client = HttpClient.newBuilder()
427+
//Stick to HTTP/1.1 by default, coz Vault Agent fails proxying h2c request to https
428+
.version(Version.HTTP_1_1);
429+
427430
if (connectTimeoutSeconds != null) {
428431
client.connectTimeout(Duration.of(connectTimeoutSeconds, ChronoUnit.SECONDS));
429432
}
@@ -465,7 +468,6 @@ private Builder buildRequest(Boolean isGetOrDelete) throws URISyntaxException, R
465468

466469
// Initialize HTTP(S) connection, and set any header values
467470
var request = HttpRequest.newBuilder()
468-
.version(Version.HTTP_1_1)
469471
.uri(uri);
470472

471473
headers.forEach(request::header);

0 commit comments

Comments
 (0)