Search code examples
spring-webfluxhttp2spring-webclientspring5

How to determine if Spring WebClient is using HTTP/2?


I would like to know whether Spring WebClient is using HTTP/2. How I can determine that?


Solution

  • Server Support for HTTP/2

    As of Spring Framework 5.1 (Reactor Netty 0.8), this server supports as well HTTP/2. JDK9+ deployments will support that protocol without specific infrastructure changes.

    Reactor is the underlying http client that is used by Spring WebClient. As of Spring Framework 5.1 this support HTTP/2.

    See also Spring Framework: HTTP/2 support for an overview.

    HTTP/2 is negotiated per connection

    Wether your request connection is using HTTP/2 or HTTP/1.1 is negotiated per connection between client and server using ALPN. The server present what http versions it is supporting, then the client is choosing HTTP/2 if both parts support it. This is done over TLS in the handshake, so it can not be detected without terminating the TLS connection.