Opened 4 years ago

Last modified 7 days ago

#1992 new enhancement

Websocket over HTTP/2 support

Reported by: ckmichael8@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.19.x
Keywords: Cc:
uname -a:
nginx -V: latest



Will NGINX ever support Websocket over HTTP/2?

Change History (3)

comment:1 by Maxim Dounin, 4 years ago

First of all, two basic things to understand:

  1. nginx does not talk Websocket protocol by itself, but rather provides a way to proxy HTTP/1.1 connection upgrades to backends;
  2. RFC 8441 defines a completely different way to establish websocket communication, using a CONNECT method.

Support for Websockets over HTTP/2 basically means that nginx will have to translate these CONNECT requests to HTTP/1.1 Upgrade requests somehow when proxying. While this might work, this doesn't look like a good solution.

Alternatively, we may consider passing such CONNECT requests as is to HTTP/2 backends (for example, when using grpc_pass), but this approach also have problems. In particular, this doesn't look compatible with HTTP/1.1 backends, which makes it hardly useful.

Overall, this is unlikely to happen unless there is a practical demand. For now it looks like there is no such demand.

For there record, it RFC 8441 currently seems to work somehow in Firefox ( and under a flag in Chrome (

comment:2 by stesaunde@…, 15 months ago

Now that HTTP/3 usage is exceeding HTTP/1.1 usage it looks like there is practical demand. Look at YARP:

NGINX and Apache web servers making HTTP/2 the default would practically eliminate the remaining HTTP/1.1 usage on the Internet and with it all corresponding compatibility issues.

comment:3 by liudongmiao@…, 7 days ago

Just implement RFC 8441 and test with Chrome and Firefox, http2 with a http/1.1 websocket backend.

However, as Chrome and Firefox doesn't support RFC 9220 (WebSockets over HTTP/3) yet, don't know how to implement.

Note: See TracTickets for help on using tickets.