Exploring HTTP/3: The Next Generation Internet Transport Protocol

Exploring HTTP/3: The Next Generation Internet Transport Protocol

HTTP
QUIC
Nginx
HTTP3
Other languages简体中文
Word count: 841
Reading time: 4.21minutes

Add support for the next generation of Internet transport protocol (HTTP/3) to the website.

Cause

Recently, while utilizing a certain tool, I discovered that the latency based on UDP protocol is significantly low, and the speed feels notably swift. Consequently, I delved into understanding the HTTP/3 protocol, making my website fully compatible. Concurrently, I conducted a feature comparison, elucidated the support situation for both clients and servers, and provided configuration examples.

Feature Comparison:

FeatureHTTP/1.1HTTP/2HTTP/3
MultiplexingNoYes (Header Multiplexing)Yes (Multiplexing)
Header CompressionNoYes (HPACK)Yes (QPACK)
PriorityNoYesYes
Server PushNoYesYes
PipeliningYes (Limited)NoNo
0-RTTNoNoYes
Connection ReuseYes (Limited)YesYes
Error RecoveryNoNoYes
SecurityNo (Plain Text Transmission)Yes (TLS)Yes (TLS in QUIC)
Transport ProtocolTCPTCPQUIC (Based on UDP)

Explanation of Features

Detailed explanation of performance features of HTTP protocol versions:

  1. Multiplexing: Allows simultaneous transmission of multiple requests and responses over a single connection, enabling parallel sending and receiving, thereby enhancing network utilization and performance.

  2. Header Compression: Reduces the size of header information in HTTP requests and responses, thereby reducing the amount of transmitted data, saving bandwidth, and reducing loading times.

  3. Priority: Enables clients to specify the priority of requests being sent, allowing servers to prioritize processing accordingly, optimizing resource allocation and enhancing user experience.

  4. Server Push: Servers can proactively push relevant resources to clients before client requests, reducing the number of requests initiated by clients and speeding up page loading.

  5. Pipelining: Allows clients to send multiple requests over a single connection without waiting for responses. However, in HTTP/1.1, the use of pipelining is limited, as not all browsers and servers support it.

  6. 0-RTT: Zero round-trip time handshake, allowing clients to reduce handshake latency by sending encrypted data when establishing a new connection. This speeds up the connection establishment process, enhancing performance.

  7. Connection Reuse: Enables multiple HTTP requests and responses to be transmitted over the same TCP connection, reducing the overhead of establishing and closing connections, thereby improving performance.

  8. Error Recovery: Provides mechanisms for recovery in case of errors during transmission, ensuring reliable data transmission.

  9. Security: Ensures the secure transmission of data. HTTP/2 and HTTP/3 encrypt data transmission using the TLS protocol, preventing the risk of data theft or tampering.

  10. Transport Protocol: HTTP/1.1 uses TCP as the transport layer protocol, while HTTP/2 and HTTP/3 use SPDY and QUIC respectively as transport layer protocols, designed to enhance performance and security. QUIC, based on UDP, offers better congestion control and connection establishment features compared to TCP.

Client Requirements

BrowserInitial Version with Implemented but Default DisabledSupport DateInitial Version with Default EnabledDate of Default Enabled VersionRemarks
ChromeStable Version (79)December 201987Early versions implemented other drafts of QUIC
EdgeStable Version (79)December 201987April 2020Edge 79 is the first version based on Chromium
FirefoxStable Version (72.0.1)January 202088April 2021
SafariStable Version (14.0)September 202016.4March 2023Apple began testing HTTP/3 support for some Safari users starting from Safari 16.4

If unsure about browser support, directly visit https://quic.nginx.org. If the QUIC icon on the website turns colorful (as shown on the article cover), it indicates browser support for HTTP3.

Server Requirements

ServerInitial Version with Implemented but Default DisabledSupport DateInitial Version with Default EnabledDate of Default Enabled VersionRemarks
LiteSpeed Web Server6.0.2June 7, 20216.0.2June 7, 2021LiteSpeed Web Server version 6.0.2 became the first version to enable HTTP/3 by default.
Caddy Web Serverv2.6.0September 20, 2022v2.6.0September 20, 2022Caddy v2.6.0 enables HTTP/3 by default.
Nginx1.25.0May 23, 20231.25.0May 23, 2023Nginx started supporting HTTP/3 from version 1.25.0. A technology preview supporting HTTP/3 was released in 2020, followed by binary package releases supporting HTTP/3 in 2023.
Cloudflare----Cloudflare released a patch integrating the quiche HTTP/3 library into Nginx.
Microsoft IIS----Microsoft IIS natively supports HTTP/3 on Windows Server 2022/Windows 11.
HAProxy2.6May 31, 20222.6May 31, 2022HAProxy supports HTTP/3 over QUIC from version 2.6.

Configuration Example

  1. Using Nginx as an example, only 'reuseport' needs to be added in one configuration file within the server block, while the remaining configuration uses 'quic' directly.
nginx
server { listen 443 ssl; listen [::]:443 ssl; # Listen for HTTP3 listen 443 quic reuseport; listen [::]:443 quic reuseport; location / { add_header alt-svc 'h3=":443"; ma=2592000'; # Add HTTP3 response header ... } ... }

Then, reload the Nginx configuration to enable HTTP/3 support. In case of incompatibility, it will automatically degrade to HTTP/2 or HTTP/1.1.

bash
# Test configuration nginx -t # Reload configuration nginx -s reload

At this point, the server setup is complete.

If using Caddy, HTTP/3 support is enabled by default.

Testing

Next, you can use the following tools for testing, taking this site as an example:

  1. Using testing websites: http3check.net or http3.wcode.net

  2. Using Chrome browser developer tools.

Note: Using proxy tools may prevent the use of HTTP3, even in Direct mode.

To enable HTTP3, TUN mode must be used.

References:

  1. HTTP/3: Past, Present, and Future
  2. HTTP/3 Wikipedia

Exploring HTTP/3: The Next Generation Internet Transport Protocol | The ideal shore