HTTP/3

Protocols & Transport Security Notes Jan 6, 2025 BASH

Definition

Remember the difference between taking a taxi versus the subway? The subway runs on fixed rails - efficient but if there’s a problem on one track, everything behind it stops. A taxi can take different routes, avoid blocked roads, and even switch routes mid-journey if conditions change. HTTP/3 is like upgrading the internet from subway-style communication (TCP) to taxi-style flexibility (QUIC). It’s the newest version of HTTP, standardized in 2022, built on a completely different foundation that solves long-standing internet performance problems.

HTTP/3’s revolutionary change is abandoning TCP (Transmission Control Protocol), which has been the foundation of internet communication since the 1970s. Instead, it uses QUIC (Quick UDP Internet Connections), developed by Google and now standardized. Why does this matter? TCP treats all data as a single stream - if one packet gets lost, everything waits for retransmission. HTTP/2 multiplexes many requests over TCP, but one lost packet still stalls all requests (head-of-line blocking at the transport layer). QUIC multiplexes at the transport layer itself, so a lost packet only affects its specific stream while others continue flowing.

The practical benefits are especially noticeable in real-world internet conditions. On mobile networks where you’re constantly switching between cell towers or moving between WiFi and cellular, HTTP/3’s connection migration keeps your session alive without interruption. In areas with packet loss (congested networks, distant servers, satellite links), HTTP/3 maintains performance where HTTP/2 would stutter. Connection establishment is also faster - QUIC combines the transport and TLS handshakes, reducing round trips. HTTP/3 represents the future of web communication, already used by major platforms like Google, Facebook, and Cloudflare.

Diagram

sequenceDiagram
    participant C as Client
    participant S as Server

    Note over C,S: HTTP/3 over QUIC (UDP-based)

    rect rgb(200, 255, 220)
        Note over C,S: 0-RTT Connection (resumption)
        C->>S: Initial + TLS + Request (combined!)
        S-->>C: Response data immediately
        Note over C,S: vs TCP+TLS: 2-3 round trips saved
    end

    rect rgb(200, 230, 255)
        Note over C,S: Independent Streams (no head-of-line blocking)
        par Stream A
            C->>S: Request A
            Note right of S: Packet lost!
            S--xC: Response A (waiting)
        and Stream B
            C->>S: Request B
            S-->>C: Response B (continues!)
        and Stream C
            C->>S: Request C
            S-->>C: Response C (continues!)
        end
        S-->>C: Response A (retransmitted)
        Note over C,S: Lost packet only affects its stream
    end

    rect rgb(255, 230, 200)
        Note over C,S: Connection Migration
        Note left of C: IP changes (WiFi to 4G)
        C->>S: Same Connection ID
        S-->>C: Session continues seamlessly
        Note over C,S: No reconnection needed!
    end

Example

Real-World Scenario 1: Mobile App on the Go You’re using Google Maps while walking and your phone switches from WiFi to cellular. With HTTP/2 over TCP, your connection breaks and must be re-established - noticeable as a brief stutter in map loading. With HTTP/3, the connection seamlessly migrates. QUIC uses connection IDs rather than IP:port pairs, so your navigation continues without interruption. This is why YouTube, Google Search, and Gmail feel smoother on mobile.

Real-World Scenario 2: Video Streaming with Packet Loss Netflix on a congested hotel WiFi network with 3% packet loss. With HTTP/2, when a packet is lost, the TCP connection stalls until it’s retransmitted - affecting ALL streams even if the lost packet was for a different video segment. With HTTP/3, only the affected stream waits; other streams continue delivering data. The video buffers more smoothly despite the poor network.

Real-World Scenario 3: Global CDN Performance Cloudflare serves a website to users worldwide, including regions with high latency and packet loss (rural areas, emerging markets, satellite connections). HTTP/3’s faster connection setup (0-RTT resumption) and independent stream handling mean pages load faster for these users. A website owner enabling HTTP/3 on Cloudflare might see 15-30% improvement in these challenging network conditions.

Real-World Scenario 4: API Performance in Lossy Networks An IoT fleet of sensors on cellular networks makes frequent API calls to report data. The networks have occasional packet loss. With HTTP/2, a lost packet causes all pending API responses to wait. With HTTP/3, each API call’s stream is independent - one lost packet doesn’t cascade into delays for other calls. The fleet reports data more reliably with the same network quality.

Analogy

The Independent Delivery Trucks: HTTP/2 is like a convoy of delivery trucks that must stay together - if the front truck stops, everyone waits. HTTP/3 is like independent delivery trucks each taking the best route. One truck hitting traffic doesn’t affect the others. They can take different routes, and if one truck breaks down, only its packages are delayed.

The Multiple Checkout Lanes: TCP is like a store with one checkout line - one slow transaction holds up everyone. HTTP/3 is like a store with independent self-checkout kiosks. A problem at one kiosk only affects that customer; everyone else continues at full speed.

The Wi-Fi Roaming Analogy: HTTP/2 is like your phone call dropping when you walk from one room to another in your house (switching access points). HTTP/3 is like a DECT cordless phone that seamlessly hands off between base stations - your conversation continues uninterrupted as you move.

The Train vs. Air Travel: TCP is like a train - efficient but stuck on rails. If there’s a problem on the track, you stop. QUIC/HTTP/3 is like air travel - pilots can route around weather, find alternate airways, and your path isn’t fixed. More resilient to disruption, especially over long distances with variable conditions.

Code Example


# Check HTTP/3 support using curl (requires curl 7.66+ with HTTP/3 support)
curl --http3 https://api.example.com/status -v

# Response headers indicate HTTP/3
HTTP/3 200
alt-svc: h3=":443"; ma=86400
content-type: application/json

{"status": "ok", "protocol": "HTTP/3"}

# Alt-Svc header tells browsers HTTP/3 is available
# Browsers will upgrade to HTTP/3 on subsequent requests

# Server configuration (Nginx with QUIC)
server {
    listen 443 quic reuseport;  # HTTP/3
    listen 443 ssl;              # HTTP/2 fallback

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    # Advertise HTTP/3 availability
    add_header Alt-Svc 'h3=":443"; ma=86400';
}

# Caddy server (automatic HTTP/3)
example.com {
    respond "Hello HTTP/3!"
}
# Caddy enables HTTP/3 by default when TLS is configured

# Testing HTTP/3 in browsers:
# 1. Visit https://quic.nginx.org/ for live test
# 2. Chrome: chrome://flags -> QUIC -> Enabled
# 3. Firefox: network.http.http3.enabled in about:config

Security Notes

SECURITY NOTES

CRITICAL: HTTP/3 (QUIC) is newer. Ensure server and client support before deploying.

QUIC Protocol Advantages:

  • Connection migration: Clients can switch networks without losing connection
  • 0-RTT resumption: Faster connection establishment for returning clients
  • Multiplexing: Multiple streams without head-of-line blocking
  • Better congestion control: Improved handling of packet loss

0-RTT Security Concerns:

  • Replay attacks: 0-RTT data can be replayed; don’t use for state changes
  • Server state: Disable 0-RTT for operations modifying state
  • Idempotent only: Only use 0-RTT for idempotent requests (GETs)
  • Client identity: Verify client identity before trusting 0-RTT data

Connection Migration Security:

  • Address validation: Validate new address before migration
  • Token validation: Verify migration tokens prevent migration spoofing
  • Attack vectors: Migration can be exploited for amplification attacks
  • Rate limiting: Limit migration attempts per connection

Cryptographic Requirements:

  • TLS 1.3: QUIC uses TLS 1.3 for encryption
  • Key derivation: Proper key derivation for each encryption level
  • Packet number protection: Encrypt packet numbers to hide sequence

Compatibility & Deployment:

  • Fallback to TCP: Have HTTP/2 fallback for unreliable networks
  • Firewall compatibility: Some firewalls may block QUIC
  • Load balancer support: Ensure load balancers support QUIC
  • Version negotiation: Handle version negotiation properly

DDoS & Amplification:

  • Amplification attacks: QUIC can amplify traffic; implement limits
  • Request flooding: Rate limit requests per connection
  • Token validation: Require tokens after initial response to limit abuse

Standards & RFCs