AbstractHandshakeHandler does not support HTTP/2 CONNECT (RFC 8441) #34044
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: waiting-for-triage
An issue we've not yet triaged or decided on
If the web server advertises that it supports RFC 8441 via the HTTP/2
SETTINGS_ENABLE_CONNECT_PROTOCOL
parameter then some web browsers (Chrome, Firefox) will follow RFC 8441 to open a WebSocket over a HTTP/2 stream using theCONNECT
HTTP method.The
org.springframework.web.socket.server.support.AbstractHandshakeHandler#doHandshake
method however only supports theGET
method and will respond with405 Method Not Allowed.
and log an error message:Handshake failed due to unexpected HTTP method: CONNECT
The work around is to disable RFC 8441 in your web server, e.g. with Jetty you can set
org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory#setConnectProtocolEnabled
to false (the default is that it is enabled in Jetty 12 EE10).This problem was observed in Spring 6.2.0.
spring-framework/spring-websocket/src/main/java/org/springframework/web/socket/server/support/AbstractHandshakeHandler.java
Lines 172 to 179 in f8fd6da
The text was updated successfully, but these errors were encountered: