Web networking
What happens on the wire: HTTP semantics, connections and HTTP/2 and 3, caching headers, CORS, cookies and service workers.
6 lessons
Connection path
- 1HTTP semantics: status codes, negotiation and redirectsA status code is data that fetch() hands back, not a verdict; and a redirect repeats the request unchanged only when its code promises to.
- 2Connection setup and HTTP/1.1 vs 2 vs 3Setup is paid in round trips, once per connection; HTTP/2 stops requests waiting for each other, but not bytes waiting behind a lost packet.
Caching
Browser security boundaries
- 4Same-origin policy and CORSThe browser enforces CORS, not the server: it decides whether a page may read a response and, for non-simple requests, whether to send it.
- 5Cookies: attributes, SameSite and partitioningSameSite asks which site started the request, and a site is a registrable domain, not an origin.