Apiman Gateway API  has `null` in URI to `.well-known` if no path element(s).
It's attempting to load the keys and other metadata from the realm.

However, if the path element is empty/null, then the URI builder turns that null into the string/word "null" which is obviously not correct

Something (approximately) like `http://localhost:8085` => `https://localhost:8085/null/realms/foo/.well-known`

Whereas it works OK if there's a path element.
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 3188dd429..299e1be1e 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -13,6 +13,9 @@ All notable changes to Apiman will be documented here (as of Apiman 3).
 
 === Fixed
 
+* [gateway-vertx]: do not include `null`/empty path elements in Keycloak discovery URI. 
+If your Vert.x Gateway API was unable to speak to Keycloak because it had an unexpected `null` in the URI, this should fix it. By https://github.com/msavy[Marc Savy (@msavy)^].
+
 * Multiple small MSSQL (Microsoft SQL Server) DDL fixes. By https://github.com/msavy[Marc Savy (@msavy)^].
 
 // end::3.2.0-SNAPSHOT[]
diff --git a/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java b/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java
index ea120f1c6..2adfab6ce 100644
--- a/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java
+++ b/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java
@@ -25,9 +25,12 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.MessageFormat;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import io.vertx.core.AsyncResult;
 import io.vertx.core.Handler;
@@ -186,9 +189,12 @@ public class KeycloakOAuthFactory {
         try {
             // Parse out initial segments
             URIBuilder builder = new URIBuilder(authServer);
+            List<String> pathSegments = Stream.of(builder.getPath(), "realms", realmName)
+                    .filter(Objects::nonNull)
+                    .collect(Collectors.toList());
             // Prepend builder.getPath to allow us to use URI with a non-zero path element (e.g. foo.com/keycloak)
             uri = builder
-                    .setPathSegments(builder.getPath(), "realms", realmName)
+                    .setPathSegments(pathSegments)
                     .build();
         } catch (URISyntaxException e) {
             throw new RuntimeException(e);
['gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java', 'CHANGELOG.adoc']