Tim Berners-Lee began the internet revolution in 1989 when he invented the HTTP protocol, allowing computers to talk to each other using relatively slow computers. As the needs to the internet increased, the protocol got a refresh in 1992 as HTTP/1.1. But even this refresh was not sufficient, since web technologies got crazier and more demanding. Increase in CPU speeds and graphics technology allowed developers to build newer-fangled applications, but the old HTTP/1.1 had its limitations. If you’ve been developing for the web for some time, the limitations/hacks below will be familiar:

HTTP/2 is the latest upgrade to the HTTP protocol, published by the Internet Engineering Task Force (IETF) in 2015. While the new version retains some of the high-level functionality like methods, status codes, etc., a lot has changed under the hood. The limitations of HTTP/1.1 listed above are now gone. HTTP/2:

This means that all that time and effort we spent speeding up our websites to get over the inherent flaws of HTTP/1.1 are no longer needed.

According to caniuse.com, the browser support for the new protocol is about 50% in India and 82% globally. Whether your users’ browsers will support this protocol or not will depend on their browser version, which you can check using your analytics tool, like Google Analytics. Also note that while HTTP/2 supports both secure and non-secure connections, both Mozilla Firefox and Google Chrome will only support HTTP/2 over HTTPS. Unfortunately, this means that many sites that want to take advantage of HTTP/2 will need to be served over HTTPS, which is not necessarily a bad thing. You should have switched to HTTPS by now anyway, especially since the server certificates are free.

HTTP/2 maintains backwards compatibility with HTTP/1.1, which means you can make the switch and your applications will still work on the older HTTP/1.1. Enabling HTTP/2 support in Nginx is pretty trivial. Just make the following changes to your secure server definition:

listen 443 ssl http2;
listen [::]:443 ssl http2;

And that’s it! Just make sure your HTTPS certificate configuration is correct, and supported browsers should begin talking to your server using the new HTTP/2. You can check this in your Chrome’s Developer Tools’ Network tab. Find the “Protocol” column, and it should say h2 for the new HTTP/2, and http/1.1 for the older HTTP/1.1.