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 | HTTP/1.1 | HTTP/2 | HTTP/3 |
---|---|---|---|
Multiplexing | No | Yes (Header Multiplexing) | Yes (Multiplexing) |
Header Compression | No | Yes (HPACK) | Yes (QPACK) |
Priority | No | Yes | Yes |
Server Push | No | Yes | Yes |
Pipelining | Yes (Limited) | No | No |
0-RTT | No | No | Yes |
Connection Reuse | Yes (Limited) | Yes | Yes |
Error Recovery | No | No | Yes |
Security | No (Plain Text Transmission) | Yes (TLS) | Yes (TLS in QUIC) |
Transport Protocol | TCP | TCP | QUIC (Based on UDP) |
Detailed explanation of performance features of HTTP protocol versions:
Multiplexing: Allows simultaneous transmission of multiple requests and responses over a single connection, enabling parallel sending and receiving, thereby enhancing network utilization and performance.
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.
Priority: Enables clients to specify the priority of requests being sent, allowing servers to prioritize processing accordingly, optimizing resource allocation and enhancing user experience.
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.
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.
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.
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.
Error Recovery: Provides mechanisms for recovery in case of errors during transmission, ensuring reliable data transmission.
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.
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.
Browser | Initial Version with Implemented but Default Disabled | Support Date | Initial Version with Default Enabled | Date of Default Enabled Version | Remarks |
---|---|---|---|---|---|
Chrome | Stable Version (79) | December 2019 | 87 | Early versions implemented other drafts of QUIC | |
Edge | Stable Version (79) | December 2019 | 87 | April 2020 | Edge 79 is the first version based on Chromium |
Firefox | Stable Version (72.0.1) | January 2020 | 88 | April 2021 | |
Safari | Stable Version (14.0) | September 2020 | 16.4 | March 2023 | Apple 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 | Initial Version with Implemented but Default Disabled | Support Date | Initial Version with Default Enabled | Date of Default Enabled Version | Remarks |
---|---|---|---|---|---|
LiteSpeed Web Server | 6.0.2 | June 7, 2021 | 6.0.2 | June 7, 2021 | LiteSpeed Web Server version 6.0.2 became the first version to enable HTTP/3 by default. |
Caddy Web Server | v2.6.0 | September 20, 2022 | v2.6.0 | September 20, 2022 | Caddy v2.6.0 enables HTTP/3 by default. |
Nginx | 1.25.0 | May 23, 2023 | 1.25.0 | May 23, 2023 | Nginx 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. |
HAProxy | 2.6 | May 31, 2022 | 2.6 | May 31, 2022 | HAProxy supports HTTP/3 over QUIC from version 2.6. |
nginxserver { 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.
Next, you can use the following tools for testing, taking this site as an example:
Using testing websites: http3check.net or http3.wcode.net
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: