HTTP 2.0 support in core http nodes?

Hi Forum,
I'm working on a project using Node-RED and I'm curious about HTTP/2.0 support. I've been looking through the documentation but haven't found a definitive answer. Does Node-RED inherently support HTTP/2.0 protocol, or is there additional configuration required? Is there a way possible to achieve this?

Any insights or experiences you can share would be greatly appreciated. Thanks!

Hi Josh,

No, Node-RED does not support HTTP/2.0. It isn't natively supported by the Express framework we run on top of. There isn't a clear path forward at this time, although it is being looked at by Express for their roadmap - http/2 initiative · Issue #5462 · expressjs/express · GitHub

Nick

I think there may be another impact? Doesn't websockets require http/1.1? Not sure if I've got that right.

Probably not insurmountable as an issue but might need another ExpressJS endpoint if using websockets and http/2.0 endpoints together.

1 Like

Oh, 1 other complication with http/2. While in theory you can use it without TLS encryption (called h2c I believe), I don't think all browsers support that (actually, it looks like no browsers do). So most likely, any implementation would have the added complexity of a TLS configuration.

http/3 absolutely requires TLS of course.

As for websockets, it looks like http/2 connections might also support 1.1, not sure how that would work in practice, it might still need 2 endpoints. But http/2 introduces server-sent streams - it looks like, once a client has accepted a stream, the stream becomes 2-way similar to websockets with 1 notable exception, server-sent streams do not support binary packets.

Clearly some new design thinking will be needed for Node-RED to successfully adopt http/2 and /3.

Thanks for the information people. Adopting to http2 would provide us with more faster api connections.

It might be worth you thinking about a reverse proxy and whether that might help. I've not really played with http/2 or /3 but certainly proxies can help with performance and can offload dealing with TLS and caching for example. So probably worth a look anyway.

So what I have done currently is using a apache server and reverse proxy it.

Apache is a bit long in the tooth now I think. :slight_smile: I generally use NGINX. Caddy or LightHttp or HAProxy would also be usable. Apache tends to be a resource hog.

So whats the positive side of using nginx over apache?

It is a much more modern approach and much better at using resources. Apache is a known resource hog and is quite long in the tooth. Also, not sure how much active development is happening on Apache. NGINX is certainly being actively developed.