What is the HTTP/2 protocol?
Hypertext Transfer Protocol version 2 (HTTP/2 or HTTP/2.0) is an application protocol and a set of standards responsible for a speedy and seamless data exchange between the client and the website. It was developed in 2015 after an HTTP revision by the Internet Engineering Task Force and derived from the SPDY protocol, providing advanced data communication.
One of the main principles of the HTTP/2 protocol is that it compresses data sent in headers and allows multiple requests and responses simultaneously, speeding up the page loads and decreasing round-trip time. Moreover, HTTP/2 works hand in hand with SSL/TLS encryption to keep the data transfer secure.
HTTP/2 features
To better understand the HTTP/2 protocol, here are some of its main features:
- Header compression. HTTP/2 compresses headers and reduces their size, speeding up the page load and communication process between the web server and the client.
- Multiplexing. It reduces latency by allowing simultaneous requests and responses.
- Stream prioritization. HTTP/2 contains a feature that helps the server to distribute the network resource allocation based on end-user demands. This process improves user experience by displaying the most essential parts of a website as quickly as possible.
- Binary framing layer. The HTTP/2 protocol uses binary (0s and 1s) rather than textual commands. A binary protocol is usually more efficient and less prone to errors. It offers reduced latency and mitigates security risks more effectively than a textual one.
- Server push. The HTTP/2 protocol prompts a server to send resources to a client without them having to request. This improves efficiency and load times.
HTTP/2 vs HTTP/1.1: The main differences
The HTTP/2 protocol doesn’t go that far from HTTP/1.1 in terms of methods, status codes, and semantics. However, what’s different is how data travels between the client and server. Let’s go through some of the critical differences between HTTP/2 and HTTP/1.1.
- Protocol type. HTTP/1.1 is a textual protocol, which might be less efficient for computers to process. HTTP/2, however, is a binary protocol that uses 0s and 1s – more convenient for computers to read and less prone to error.
- Multiplexing. The HTTP/2 protocol allows you to send multiple requests and responses when connected to a web server, which reduces latency and allows you to browse seamlessly. HTTP/1.1, on the other hand, doesn’t offer multiplexing over a single TCP connection and only supports one request per connection at a time.
- Compression. HTTP/2 uses HPACK to compress the headers of both request and response, minimizing the data sent over the network and saving bandwidth. Compression is beneficial when sending multiple requests in high-traffic applications. HTTP/1.1, however, doesn’t have a default header compression feature.
- Server push. HTTP/2 supports server push and sends all the external resources to the browser before the client requests them. HTTP/1.1 doesn’t offer this feature, and the client must explicitly request the resources.
- Stream prioritization. HTTP/2 offers steam prioritization, which lets the user prioritize which website segments are most important and should be loaded first. On the flip side, HTTP/1.1 loads all the web parts simultaneously, which can be inefficient for loading web pages with multiple elements.
- Security. Binary HTTP/2 format prevents response splitting attacks common with HTTP/1.1. Hackers carry out response splitting by altering the textual response and inserting whitespaces. This is not a threat to an HTTP/2 binary protocol. Moreover, HTTP/2 comes with TLS encryption, ensuring security and privacy. TLS is optional with HTTP/1.1.
- Resource loading. HTTP/1.1 is usually slower than HTTP/2 due to the one-request-per-connection model and the absence of request prioritization. HTTP/2 offers efficient browsing by employing multiplexing, HPACK header compression, server push, and prioritization features.
Here’s a summary of the main differences between HTTP/2 and HTTP/1.1:
Features | HTTP/2 | HTTP/1.1 |
---|---|---|
Protocol type | Binary | Text-based |
Multiplexing | Multiplexing of requests over a single connection | One request per connection |
Compression | HPACK compression to reduce overhead | No compression (headers sent as plain text) |
Server push | Supported (server can send resources before they are requested) | Not supported |
Stream prioritization | Supported (requests can be prioritized) | Not supported |
Security | Run with TLS | Optional (can be run with or without TLS) |
Resource loading | More efficient and faster due to multiplexing and prioritization | Inefficient under certain conditions due to connection limitations |
The main benefits of HTTP/2
The main benefits of using HTTP/2 are efficiency solutions to improve web performance, optimize resource use, and reduce browsing latency. One of the most beneficial HTTP/2 features is multiplexing, which handles multiple streams simultaneously over a single connection, reducing network latency. It also improves performance by compressing HTTP headers sent over the network and prioritizing network resource allocation. Moreover, the HTTP/2 binary protocol format and default TLS encryption can help enhance browsing security.
Why is HTTP/2 not widely used?
The adoption of HTTP/2, currently at around 35.6% of websites, is not as widespread as network engineers might have expected. This could be due to several reasons. First, employing HTTP/2 might be costly and complex for organizations with widespread infrastructure. Correctly establishing HTTP/2 may require extra technical knowledge. Moreover, some older browsers may not be compatible with the HTTP/2 protocol. So organizations that serve a diverse user base may hesitate to adopt it.
Furthermore, the performance gain from HTTP/2 may not be sufficient enough to invest funds and human and server resources into adopting the protocol for smaller websites. Another reason system admins opt out of HTTP/2 is that the content delivery network that enhances web performance cannot fully support HTTP/2, reducing the expected needs. Sometimes organizations don’t see the point of integrating HTTP/2 into their systems because the existing setup is sufficient.
Do all browsers support HTTP/2?
As of November 2023, a large majority of desktop web browsers support HTTP/2. However, some older browser versions might not be compatible with this protocol. These include Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, and Opera versions released before 2015, when HTTP/2 was introduced to the public.
It is important to note that Internet Explorer only partially supports HTTP/2, while its older versions don’t support the protocol. And finally, niche and specialized browsers created for specific purposes might not be compatible with HTTP/2 as well.
How to check if a website has HTTP/2 protocol support
Here’s an easy way to find out if a website supports the HTTP/2 protocol:
- 1.Right-click anywhere on the website and select "Inspect."
- 2.In the top bar, click on "Network."
- 3.Right-click on the header of the table and select "Protocol."
- 4.If needed, refresh the page with the console open.
Websites that support HTTP/2 will be labeled as “h2.”
What is the alternative to HTTP/2?
One of the main HTTP/2 alternatives is its predecessor HTTP/1.1, a to-go protocol until 2015, when network developers introduced us to its more advanced version. Later, HTTP/2 was improved to the HTTP/3 protocol, which was built upon the success of its previous version but replaced the TCP connection with the QUIC transport protocol. QUIC is considered to be more efficient, employing advanced technology and improving mobile and lossy networks.
Even though there are no direct replacements for the Hypertext Transfer Protocol, you may choose other protocols depending on your needs. You can give file transfer protocol (FTP) a chance, which is a specialized protocol that handles large file transfers or file access. Or take a look at WebSocket, designed for real-time, two-way communication between client and server, like chat applications or interactive games.
Like what you’re reading?
Get the latest stories and announcements from NordVPN
We won’t spam and you will always have the choice to unsubscribe