NodeJS and HTTP/2

Is it posible to get NodeJS to serve HTTP/2 as default?

Wouldn’t it require a local ssl certificate? Maybe not for env=development?

I think that it is a matter of adding the module and changing line 7 in:

The great majority of browsers will only use http/2 via https.

Apparently, the working group did not have consensus to require the use of encryption. What I did not know was that currently no browser supports http/2 unecrypted.

This should however be a mute point, with the likes of free certificates, no site should be left without TLS.

In almost all cases you use the nodejs server behind a reverse proxy, often nginx is used for this. The proxy will serve the site as https / http/2 and forwards the calls to nodejs. So nodejs runs in normal http and is not accessed directly.

4 Likes

I was referring exclusively about the local dev environment. I don’t want to be messing around with certificates there for each project I start :slight_smile:

In any case I agree with Patrick that you don’t normally use node as a production server to serve the files directly.

Thank you Patrick, have done as you have said and works well with nginx

1 Like