diff --git a/spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/handler/predicate/MethodRoutePredicateFactory.java b/spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/handler/predicate/MethodRoutePredicateFactory.java index 38d096e710..ccd8777758 100644 --- a/spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/handler/predicate/MethodRoutePredicateFactory.java +++ b/spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/handler/predicate/MethodRoutePredicateFactory.java @@ -56,6 +56,9 @@ public Predicate apply(Config config) { @Override public boolean test(ServerWebExchange exchange) { HttpMethod requestMethod = exchange.getRequest().getMethod(); + if (requestMethod == null) { + return false; + } return stream(config.getMethods()).anyMatch(httpMethod -> httpMethod == requestMethod); }