Opscraft
Foundations: Linux, scripting, Git & networking

HTTP & status codes

Must-know9 lessons · 31 min · 3 tests ·

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.

Stage 1 · Foundations

Know these first

After this topic you can

  • Read HTTP requests, headers and status codes
  • Tell a 502 from a 503 or 504 and know where to look
  • Explain redirects, caching and how retries and SLOs use status codes

Lessons

  1. 1HTTP fundamentals 4 min read
    • Request and response anatomy
    • Methods and their semantics
    • Versions
    • Headers that matter in operations
  2. 2The five classes, 1xx and 2xx 3 min read
    • Classes in ten seconds
    • 1xx informational
    • 2xx success
  3. 33xx redirection and caching 3 min read
    • Redirect codes
    • 304 Not Modified
  4. 44xx client errors 4 min read
    • The codes you'll meet
    • 401 vs 403 precisely
    • 4xx and SLOs
  5. 55xx server errors and who generates them 3 min read
    • The codes
    • Who generated the 5xx?
  6. 6Troubleshooting 502, 503 and 504 on AWS and Kubernetes 5 min read
    • 502 Bad Gateway
    • 503 Service Unavailable
    • 504 Gateway Timeout
    • Reading ALB access logs
    • A response playbook: "5xx spiking after a deploy"
  7. 7Kubernetes ingress and AWS service specifics 3 min read
    • Ingress returns 404 for a path that should work
    • S3 returns 403 for a static site
    • CloudFront 403/404 on SPA routes
    • API Gateway quirks
    • Health checks and redirects
    • Liveness vs readiness endpoints
  8. 8Monitoring, SLOs, retries and API design 3 min read
    • What to alert on
    • Retry policies
    • Status codes in API design (what good looks like)
  9. 9Interview questions and model answers 3 min read
    • "Explain 502 vs 503 vs 504."
    • "Users get 504 after exactly 60 seconds through an ALB. Why?"
    • "Intermittent 502s behind an ALB with 'target closed connection'. Fix?"
    • "401 vs 403?"
    • "You see 502s spiking right after a deploy. What do you do?"
    • "Should clients retry on 500?"
    • "Why are 4xx errors often excluded from SLOs?"
    • "What does a 499 in Nginx logs mean?"