diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java index 54e83ead17432a..8fb4a5db260db3 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java @@ -25,6 +25,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; +import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.HttpVersion; import jakarta.enterprise.inject.Instance; import org.jboss.logging.Logger; @@ -216,7 +218,13 @@ public void handle(Void unused) { // TODO -- handle Avro, plain text ... when supported / needed private static boolean isGrpc(RoutingContext rc) { - String header = rc.request().getHeader("content-type"); + HttpServerRequest request = rc.request(); + HttpVersion version = request.version(); + if (HttpVersion.HTTP_1_0.equals(version) || HttpVersion.HTTP_1_1.equals(version)) { + LOGGER.debugf("Expecting %s, received %s - not a gRPC request", HttpVersion.HTTP_2, version); + return false; + } + String header = request.getHeader("content-type"); return header != null && GRPC_CONTENT_TYPE.matcher(header.toLowerCase(Locale.ROOT)).matches(); }