Here's a preview from my zine, HTTP: Learn your browser's language!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
HTTP/2 is a new version of HTTP. Here’s what you need to know:
A lot isn’t changing
All the methods, status codes, request/response bodies, and headers mean exactly the same thing in HTTP/2.
before (HTTP/1.1):
method: GET
path: /cat.gif
headers:
- Host: examplecat.com
- User-Agent: curl
after (HTTP/2):
method: GET
path: /cat.gif
authority: examplecat.com
headers:
- User-Agent: curl
one change:
Host header => authority
HTTP/2 is faster
Even though the data sent is the same, the way HTTP/2 sends it is different. The main differences are:
- It’s a binary format (it’s harder to tcpdump
traffic and debug)
- Headers are compressed
- Multiple requests can be sent on the same connection at a time
before (HTTP/1.1):
→ request 1
response 1 ←
→ request 2
response 2 ←
after (HTTP/2):
→ request 1
→ request 2
response 2 ←
response 1 ← (out of order is ok)
(one TCP connection)
All these changes together mean that HTTP/2 requests often take less time than the same HTTP/1.1 requests.
Sometimes you can switch to it easily
A lot of software (CDNs, nginx) let clients connect with HTTP/2 even if your server still only supports HTTP/1.1.
- Firefox to CDN: HTTP/2 request
- CDN to your server: HTTP/1.1 request
- your server to CDN: HTTP/1.1 response
- CDN to Firefox: HTTP/2 response
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!