One HTTP Request
An HTTP request is a function call across the network. Methods, headers, ETag, and status codes, including the HEAD and 405 that later broke a cache layer.
A request is like a function call across the network. The request carries the arguments. The response is the return value.
I am a backend engineer and I write APIs every day. But I rarely looked at the details of headers and status codes. This chase made me look at them again.
- Header: one line of
name: value. Every layer in the middle (CDN, load balancer) reads headers. Some layers add their own headers (Cache Headers: Who Sets, Who Reads). - ETag: a version label for the file content. When the content changes, the ETag changes too.
Method
- GET: “Give me the file.” The response has headers and a body.
- HEAD: “Give me only the headers.” The headers are the same as for GET, and the body is empty. A cache can use HEAD to check the ETag, size, and date of a file without downloading it.
Status Code
At first I thought HEAD and 405 were obscure facts. Later, the key to the whole problem was one HEAD request that got a 405 (The Proxy Rejects HEAD, So the Refresh Always Fails).
Obscure methods and status codes are often where a bug hides.
Related: What a CDN Is, Cache Freshness: Fresh, Stale, and 304, Cache Headers: Who Sets, Who Reads, The Proxy Rejects HEAD, So the Refresh Always Fails. Or go back to the series overview.