|
| 1 | +--- |
| 2 | +title: "HTTP/3 for Backend Developers (and Curious Humans)" |
| 3 | +classes: wide |
| 4 | +header: |
| 5 | + teaser: /assets/images/posts/http3/teaser.png |
| 6 | + overlay_image: /assets/images/posts/http3/teaser.png |
| 7 | + overlay_filter: 0.4 |
| 8 | +ribbon: DarkSlateGray |
| 9 | +excerpt: "A backend-friendly introduction to HTTP/3, how it differs from HTTP/2, and why QUIC is changing the rules of the web" |
| 10 | +description: "From HTTP/1.1 to HTTP/3 - why QUIC matters for backend performance, security, and user experience" |
| 11 | +categories: |
| 12 | + - Web Performance |
| 13 | + - Backend |
| 14 | + - Blog |
| 15 | +tags: |
| 16 | + - HTTP3 |
| 17 | + - HTTP2 |
| 18 | + - QUIC |
| 19 | + - FastAPI |
| 20 | + - Performance |
| 21 | + - Security |
| 22 | + - Networking |
| 23 | +toc: true |
| 24 | +toc_sticky: true |
| 25 | +toc_label: "200 OK: Meet HTTP/3.0" |
| 26 | +toc_icon: "bolt" |
| 27 | +--- |
| 28 | + |
| 29 | +# EHLO from HTTP/3.0 |
| 30 | + |
| 31 | +Yes, I know **EHLO** is an SMTP command, not HTTP - but I couldn’t resist borrowing it as a geeky “hello.” |
| 32 | +Think of it as my way of introducing a protocol with another protocol’s greeting. |
| 33 | + |
| 34 | +Now that we’ve broken the ice - HTTP/3 is here, and while it still speaks “HTTP,” it drives on a completely different highway. |
| 35 | +For backend developers, this is the first time in decades that the transport layer underneath HTTP is changing - and it’s a big deal for both **performance** and **security**. |
| 36 | +And don’t worry, if you’re not a backend developer, I promise to keep it human-friendly ;) |
| 37 | + |
| 38 | + |
| 39 | +## From HTTP/1.1 → HTTP/2 → HTTP/3 |
| 40 | + |
| 41 | +Before we jump into QUIC, let’s quickly rewind. |
| 42 | + |
| 43 | +**HTTP/1.1 (1997)** |
| 44 | +- One request per TCP connection |
| 45 | +- Browsers opened multiple connections to speed things up |
| 46 | +- Head-of-line blocking was a nightmare (one slow resource could block others) |
| 47 | + |
| 48 | +**HTTP/2 (2015)** |
| 49 | +- Multiplexing: multiple streams over a single TCP connection |
| 50 | +- Header compression (HPACK) |
| 51 | +- Server push |
| 52 | +- BUT… still TCP, still suffers from TCP-level head-of-line blocking. |
| 53 | + |
| 54 | +**Why that’s a problem:** TCP delivers packets in order. If one packet is lost, everything behind it waits, even if it’s unrelated. |
| 55 | + |
| 56 | +## Why HTTP/3 Exists |
| 57 | + |
| 58 | +Mobile users switch networks all the time. One moment they’re on Wi-Fi, the next they’re on 5G - and TCP hates that. |
| 59 | +Every network change = connection drop = new handshake. |
| 60 | + |
| 61 | +HTTP/3 fixes this by ditching TCP entirely and running on **QUIC** (Quick UDP Internet Connection), a modern transport protocol built on **UDP**, designed to improve the speed and reliability of web connections. |
| 62 | + |
| 63 | +## QUIC in a Nutshell |
| 64 | + |
| 65 | +If TCP is like a polite postal service (guaranteed delivery, in order, with signatures), QUIC is like a private courier with GPS tracking, encryption, and a motorcycle. |
| 66 | + |
| 67 | +**Key QUIC benefits:** |
| 68 | +- **Runs over UDP** → avoids TCP’s head-of-line blocking |
| 69 | +- **TLS 1.3 built-in** → always encrypted, faster handshake |
| 70 | +- **Connection migration** → keeps working when your IP changes |
| 71 | +- **0-RTT handshakes** → faster page loads, especially after reconnects |
| 72 | +- **Better congestion control** for flaky networks |
| 73 | + |
| 74 | +⚠️ **Note:** QUIC doesn’t make lost data magically appear. |
| 75 | +If a missing packet belongs to a specific stream, that stream must still wait for it before it can continue (e.g., you can’t render half an HTML file). |
| 76 | +The benefit is that **other streams keep flowing** instead of getting stuck behind the delay - something TCP can’t do because all streams share the same ordered delivery queue. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +## How HTTP/3 Stacks Up |
| 81 | + |
| 82 | +```plaintext |
| 83 | +HTTP/1.1 --> TCP --> TLS (optional) --> Internet |
| 84 | +HTTP/2 --> TCP --> TLS (usually) --> Internet |
| 85 | +HTTP/3 --> QUIC --> UDP + TLS 1.3 --> Internet |
| 86 | +```` |
| 87 | +
|
| 88 | +**Visual flow:** |
| 89 | +
|
| 90 | + |
| 91 | +
|
| 92 | +## Backend Developer View |
| 93 | +
|
| 94 | +**Your application logic?** Probably won’t change. |
| 95 | +**Your infrastructure?** That’s where you’ll notice the difference. |
| 96 | +
|
| 97 | +* **Server/CDN support:** nginx, Caddy, Cloudflare, AWS CloudFront, Fastly already support HTTP/3 |
| 98 | +* **Reverse proxy configs:** may need new ports, certs, and UDP forwarding |
| 99 | +* **Debugging:** trickier, since QUIC encrypts transport layer |
| 100 | +* **Fallback:** clients that don’t speak HTTP/3 will use HTTP/2 or HTTP/1.1 |
| 101 | +
|
| 102 | +## Security Gains |
| 103 | +
|
| 104 | +With HTTP/3, **TLS 1.3 is non-optional** - no “accidentally unencrypted” requests. |
| 105 | +Shorter handshakes = less time for attackers to interfere. |
| 106 | +Stronger forward secrecy and faster recovery after connection drops. |
| 107 | +
|
| 108 | +## Performance Gains |
| 109 | +
|
| 110 | +* **Lower latency** on initial connections |
| 111 | +* **Smooth performance on flaky mobile networks** |
| 112 | +* **Multiplexed streams without TCP-level blocking** |
| 113 | +* Faster repeated connections with **0-RTT** |
| 114 | +
|
| 115 | +## Example: FastAPI with HTTP/3 |
| 116 | +
|
| 117 | +You can run a FastAPI app with HTTP/3 using `hypercorn`: |
| 118 | +
|
| 119 | +```bash |
| 120 | +pip install hypercorn[http3] fastapi |
| 121 | +``` |
| 122 | + |
| 123 | +**`app.py`** |
| 124 | + |
| 125 | +```python |
| 126 | +from fastapi import FastAPI |
| 127 | + |
| 128 | +app = FastAPI() |
| 129 | + |
| 130 | +@app.get("/") |
| 131 | +async def root(): |
| 132 | + return {"message": "Hello HTTP/3"} |
| 133 | +``` |
| 134 | + |
| 135 | +Run with: |
| 136 | + |
| 137 | +```bash |
| 138 | +hypercorn app:app \ |
| 139 | + --bind localhost:443 \ |
| 140 | + --certfile cert.pem \ |
| 141 | + --keyfile key.pem \ |
| 142 | + --quic-bind localhost:4433 |
| 143 | +``` |
| 144 | + |
| 145 | +Visit with a browser that supports HTTP/3 (Chrome, Firefox, Edge) and check in dev tools → Network → Protocol. |
| 146 | + |
| 147 | +## Who’s Already Using HTTP/3 |
| 148 | + |
| 149 | +* Google Search & YouTube |
| 150 | +* Facebook & Instagram |
| 151 | +* Cloudflare-powered sites |
| 152 | +* Most major CDNs |
| 153 | + |
| 154 | +## Final Thoughts |
| 155 | + |
| 156 | +HTTP/3 isn’t just “HTTP/2 but faster.” |
| 157 | +It’s a new transport layer designed for **a mobile-first, encryption-by-default web**. |
| 158 | +Whether you’re a backend developer, a network engineer, or just someone tired of loading spinners - HTTP/3 is worth paying attention to. |
| 159 | + |
| 160 | +Because in the new web, speed and security are not optional - they’re the starting point. |
0 commit comments