diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java index 606c668200a4..cd3a2b345789 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java @@ -22,6 +22,7 @@ import javax.net.ssl.SSLSession; +import io.netty.channel.Channel; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.cookie.Cookie; import io.netty.handler.ssl.SslHandler; @@ -155,7 +156,11 @@ public InetSocketAddress getRemoteAddress() { @Override @Nullable protected SslInfo initSslInfo() { - SslHandler sslHandler = ((Connection) this.request).channel().pipeline().get(SslHandler.class); + Channel channel = ((Connection) this.request).channel(); + SslHandler sslHandler = channel.pipeline().get(SslHandler.class); + if (sslHandler == null && channel.parent() != null) { // HTTP/2 + sslHandler = channel.parent().pipeline().get(SslHandler.class); + } if (sslHandler != null) { SSLSession session = sslHandler.engine().getSession(); return new DefaultSslInfo(session);