Baidu CDN already supports the HTTP/2 protocol, and HTTP/2 is enabled by default. The user shall confirm that HTTPS configuration is enabled at first during their use, so as to ensure that HTTPS certificate is added successfully. The user can enable HTTPS configurations through Baidu AI Cloud CDN API or CDN console, and use HTTP/2 after successful configuration.
HTTP/2 is a new version of HTTP and was officially published by IETF as RFC 7540 in May 2015. It is mainly based on the SPDY protocol, highly compatible with HTTP/1.1 in request methods, status codes, URIs and most HTTP header fields and has the following optimizations to improve the browser’s page loading speed and reduce network latency:
- Single long connection: A single page can reuse one link instead of creating a new one, and the delay led by creating multiple TCP links can be optimized to improve handling capacity.
- Multiplex: In a single connection, multiple requests or responses can co-exist on multiple independent streams simultaneously to avoid HOL blocking (Head of Line Blocking).
- Priority ranking: Mark dependent hierarchy for the requests; same hierarchy supports priority ranking for requests and responses, and Server can successively rank to fill the data to improve the response speed of the requests.
- Header compression and binary encoding: HTTP/2 introduces the HPACK algorithm, using it to compress HTTP headers to reduce the transmission of header data. In addition, HTTP header uses binary system coding to transmit, replacing the plain text transmission in HTTP/1.x.
- Server push: The server sends more data to client than the client requests, that is, the server is allowed to provide the resources required by browser to render the page, without the need to initiate another round of request after the browser receives or parses the page, thus saving load time.
- SSL encryption: HTTP/2 supported by mainstream browsers are all based on SSL encryption, making the website more secure while ensuring performance. Under the support of ALPN, the client can initiatively select whether to use HTTP/2 or HTTP/1.1 to improve compatibility.
HTTP/2 allows to send requests and response messages alternately on the same connection. When using the highly efficient encoding HTTP Header field, you can define the priority of requests to have quicker response to more important requests. This protocol reduces the establishment of TCP connection, with less competition with other streams and longer links, which can effectively improve the utilization of the network capacity.
- Highly-efficient: The header compression and binary coding improves the efficiency of request and response, and multiplexing can avoid HOL clogging.
- Flexible: You can access more important response request quickly by defining the priority of the request.
- Rapid: The server push can get the resources pushed to client by the server in advance, so as to improve the page loading speed.
- Security: Mainstream browsers all support the HTTP/2 protocol based on TLS encryption to ensure the security of the customer’s website.