HTTP/2, originally named HTTP/2.0, is another revision of the HTTP network protocol after HTTP/1.1. HTTP/2 is a binary protocol that supports multiplexing and header compression. It greatly improves web performance and reduces network latency. This topic describes the concepts, benefits, use scenarios, and configuration method of HTTP/2.
- If this is the first time you configure an SSL certificate, you must wait until the certificate takes effect before you can enable HTTP/2.
- If you disable the SSL certificate, the HTTP/2 settings are dimmed.
- If you disable the SSL certificate after you enable HTTP/2, HTTP/2 is automatically disabled.
What is HTTP/2?
HTTP/2, originally named HTTP/2.0, is the latest version of HTTP. Compared with HTTP/1.1, HTTP/2 supports more features, including multiplexing, header compression, request prioritization, and server push. HTTP/2 provides optimized performance and is compatible with HTTP/1.1 semantics. HTTP/2 is supported by major browsers such as Google Chrome, Microsoft Edge, Safari, and Mozilla Firefox.
- Binary encoding: Unlike the newline delimited plaintext HTTP/1.x protocol, all HTTP/2 communication is split into smaller messages and frames, each of which is encoded in binary format. The binary encoding mechanism makes HTTP/2 more extensible. For example, frames are introduced to transmit data and instructions.
- Multiplexing: HTTP 1.x requires sprites and multiple domain names to improve performance because browsers limit the number of requests to the same domain name. If a large number of resources on a page are requested by clients, head-of-line blocking (HOL blocking) may occur. If the number of requests reaches the upper limit, the requests must wait in the queue because only one request can be delivered at a time per connection. HTTP/2 is the new framing layer, at which bidirectional streams (requests and responses) can be transmitted over the same TCP connection. Each stream has a unique identifier and headers based on which the stream is encapsulated between the client and server. This mechanism eliminates HOL blocking and improves transmission performance.
- Header compression: Each HTTP message carries a large number of headers that describe the transferred resource and properties. To reduce the overhead and improve performance, HTTP/2 uses HPACK compression. HTTP/2 requires both the client and server to maintain and update an indexed list of header fields. This list is used as a reference to encode previously transmitted values by transferring index values. This improves the data transmission efficiency and performance.
- Server push: Server push enables a server to send multiple responses to a single client. In addition to the response to the original request, the server can push additional resources to the client.
Enable or disable HTTP/2
- Log on to the DCDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the domain name that you want to manage, and click Configure in the Actions column.
- In the left-side navigation pane on the details page of the specified domain name, click HTTPS Settings.
- In the HTTP/2 Setting section, turn on HTTP/2.