Missing protocol HTTP2 that make your site faster, simpler, and more robust
Description
This rule determines if the network protocol HTTP/2
is being used. The second iteration of the HTTP/1.1
protocol, known as HTTP/2
, aims to address many of the issues with the previous HTTP/1.1
version in order to make applications faster and more robust. One of the ways in which HTTP/2
is faster is in how it prioritizes content during the loading process. HTTP/1.1
loads a single request for every TCP connection, while HTTP/2
avoids network delay by using multiplexing.
Some key features of HTTP/2
include:
- Binary:
HTTP/2
encapsulates data using a binary protocol. WithHTTP/1.1
, messages are transmitted in plaintext. That leads to the difference in the amount of data being transferred:Comparison amount of data being transferred HTTP/1.1
HTTP/2
Uncompressed size 34.6KB 34.6KB Bytes transferred 28.2KB 21.4KB Given that the server settings were left unchanged, the automatic benefit is that the binary format has decreased the sent size by
7.4KB
. - Multiplex: permits multiple requests and responses to be sent at the same time.
HTTP/2
does this by splitting data into binary-code messages and numbering these messages so that the client knows which stream each binary message belongs to. - Compression: compresses headers that have been requested previously to make things more efficient.
- Stream prioritization: this allows for the exchange of successive streams at one time.
- Server push: The server can send additional information needed for a request before it is requested.
- Increased security:
HTTP/2
is supported through encrypted connections. - Header compression: every
HTTP
transfer contain headers that describe the sent resource and its properties. This metadata can add up to1KB
or more of overhead per transfer, impacting the overall performance. To solve that issue,HTTP/2
uses HPACK compression to decrease the average size of the header.
SEO Benefits
Search engines like Google or Bing are all about page speed and they reward sites that improve their speed loading performance. One of the biggest SEO benefits of upgrading to HTTP/2
is that it will lead to faster loading, especially on mobile devices, resulting in a better user experience.
How to fix it
- Enable HTTP/2 protocol on the server where your app/site is. Read how to enable protocol HTTP/2 for Nginx or how to enable protocol HTTP/2 for Apache.
Standard
Rule ID: missing-protocol-http2
Best Practice, Performance, SiteLint