Translator: For it

The original link

The purpose of this article is to show you, by comparison, why you should migrate from HTTP to HTTPS and why you should add HTTP/2 support. Before comparing HTTP to HTTP/2, let’s take a look at what HTTP is.

What is the HTTP

HTTP is a set of rules for communicating on the World Wide Web. HTTP is an application-layer protocol that runs on top of TCP/IP. When a user requests a Web page through a browser, HTTP handles the request and establishes a connection between the Web server and the client.

Pay attention to

  • HTTP is a synchronization protocol.
  • Data is sent in plain text over HTTP. This is insecure, making man-in-the-middle attacks possible.
  • Multiple TCP connections: Means more round trips are required to establish a connection.
  • HTTP is a stateless protocol. Each command is executed independently.

Sites that use HTTP (insecure)

What is the HTTPS

HTTPS is the Secured version of HTTP. The communication between the Web server and clients is encrypted using TLS or Secure Socket Layer (SSL).

Sites that use HTTPS (secure)

Comparison test between HTTP and HTTPS

Each test loads 360 different images without caching (0.62 MB total). After multiple tests, HTTPS loaded 37% faster than the insecure HTTP. This is one more reason to migrate from HTTP to HTTPS.

The results of

Pay attention to

  • Secure connection. All data transmitted over HTTPS is encrypted.
  • Faster than insecure HTTP loading.
  • Service Workers, Geo Location, Camera API and so on are only supported under HTTPS.

HTTP/2

HTTP/2 is the next version of HTTP. HTTP/2 addresses many of the problems of HTTP/1.1.

Pay attention to

  • Only one TCP connection: fewer round trips to establish the connection.
  • Binary: The server can easily parse without having to convert from text to binary.
  • Multiplexing: Multiple requests can be made simultaneously (up to 6-8).
  • Header compression: HTTP headers are compressed and therefore reduced in size.
  • Server push: The server can send resources to clients that have not yet requested them.
  • Request priority: Each request can be prioritized to ensure that important resources are requested first.

HTTPS versus HTTP/2

This test is similar to the previous tests, but the environment supports HTTP/2. Each test loads 36 unique, uncached images (292 KB in total). After many tests, HTTP/2 loads 80% faster than HTTPS.

The results of

Browser support for HTTP/2

Source: caniuse.com

Supports HTTP/2 CDN

  • cloudflare
  • maxcdn
  • keycdn

conclusion

With HTTP/2, performance can be improved without Sprite graphics, compression, and concatenation. However, this does not mean that these technologies should not be used. However, this makes it clear that we need to move from HTTP/1.1 to HTTP/2.

Thanks for reading. Leave a comment if you have any questions, share if you have any questions?