HTTP & status codes · Lesson 1 of 9 · 4 min read
HTTP fundamentals
HTTP status codes are the first signal in almost every web incident: a spike of 502s after a deploy, 504s at exactly 60 seconds, 403s from S3, 429s from an upstream API. For a DevOps engineer the important skill isn't memorising the list — it's knowing which component generated a code (CDN, load balancer, ingress, proxy, app) and what each code implies about the failure. This topic covers HTTP fundamentals, every status class with the codes that matter, a deep troubleshooting guide for 502/503/504 on AWS and Kubernetes, and how status codes feed monitoring, SLOs and retry policies.
Request and response anatomy
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
The status code is a three-digit number; the first digit is the class. The reason phrase ("OK") is informational only — HTTP/2 and HTTP/3 drop it entirely.
Methods and their semantics
| Method | Purpose | Safe | Idempotent |
|---|---|---|---|
| GET | Read a resource | Yes | Yes |
| HEAD | GET without the body | Yes | Yes |
| OPTIONS | Capabilities; CORS preflight | Yes | Yes |
| POST | Create / trigger processing | No | No |
| PUT | Replace a resource at a known URI | No | Yes |
| PATCH | Partial update | No | Not necessarily |
| DELETE | Remove a resource | No | Yes |
- Safe = doesn't change server state.
- Idempotent = repeating the request has the same effect as doing it once. This decides what can be retried automatically: retrying a GET or PUT is fine; blindly retrying a POST can charge a customer twice — unless the API supports idempotency keys (
Idempotency-Keyheader, as payment APIs do).
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Versions
- HTTP/1.1 — text protocol, persistent connections (keep-alive), one request at a time per connection.
- HTTP/2 — binary framing, multiplexing many streams on one TCP connection, header compression (HPACK). Used by gRPC.
- HTTP/3 — HTTP over QUIC (UDP): no TCP head-of-line blocking, faster setup.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Headers that matter in operations
| Header | Why it matters |
|---|---|
Host |
Virtual hosting; ingress/ALB host-based routing |
X-Forwarded-For, X-Forwarded-Proto |
Client IP and original scheme behind proxies/LBs |
X-Request-ID / traceparent |
Correlate a request across LB, ingress, services and logs |
Location |
Target of redirects and newly created resources |
Retry-After |
When to retry after 429/503 |
Cache-Control, ETag, Last-Modified |
Caching and conditional requests (304) |
WWW-Authenticate |
Sent with 401 to say how to authenticate |
Strict-Transport-Security |
HSTS — always use HTTPS |
Allow |
Sent with 405 — which methods are allowed |
Connection: keep-alive / Keep-Alive |
Connection reuse and timeouts |