Opscraft
HTTP & status codes · Lesson 4 of 9 · 4 min read

4xx client errors

The codes you'll meet

Code Meaning Typical DevOps cause
400 Bad Request Malformed request Bad JSON, invalid headers, oversized cookies, HTTP sent to HTTPS port (nginx's "plain HTTP request was sent to HTTPS port")
401 Unauthorized Not authenticated — missing/invalid credentials ("who are you?") Expired/invalid token, wrong audience/issuer, clock skew, Authorization header stripped by a proxy
403 Forbidden Authenticated (or not needed) but not allowed IAM/bucket policy, WAF rule, IP allow-list, RBAC, CSRF
404 Not Found Resource doesn't exist Wrong path, ingress path rules, deleted object
405 Method Not Allowed Path exists, method not supported (send Allow header) POST to a GET-only route; CORS preflight not handled
406 Not Acceptable Can't produce the requested Accept type Content negotiation
408 Request Timeout Client too slow sending the request Slow clients, idle connections
409 Conflict Conflicts with current state Duplicate creation, optimistic-locking version mismatch (Kubernetes API returns 409 on resourceVersion conflicts)
410 Gone Permanently removed Retired API versions
413 Payload Too Large Body too big Nginx client_max_body_size (default 1 MB), API Gateway 10 MB limit
414 URI Too Long URL too long Huge query strings
415 Unsupported Media Type Wrong Content-Type Sending form data to a JSON API
422 Unprocessable Content Well-formed but semantically invalid Validation failures (many APIs use 400 instead)
429 Too Many Requests Rate limited (send Retry-After) API Gateway throttling, WAF rate rules, third-party API limits
431 Request Header Fields Too Large Headers too big Bloated cookies/JWTs
451 Unavailable For Legal Reasons Blocked legally Geo/legal blocking

Nginx-specific: 499 — "client closed request": the client gave up (timeout, user navigated away) before Nginx responded. A rise in 499s usually means your backend is slow and clients are timing out first.

401 vs 403 precisely

  • 401 means the request lacks valid authentication; the server should send WWW-Authenticate. Fix by authenticating.
  • 403 means the server knows (or doesn't care) who you are and refuses. Re-authenticating won't help; permissions must change.

Return 404 instead of 403 when even revealing that a resource exists is sensitive (private repos, other tenants' objects); return 403 when existence isn't secret and a clear message helps the user.

Enlarge diagram401 Unauthorized · "who are you?"403 Forbidden · "not allowed"Credentials missing, expired or invalidServer sends WWW-AuthenticateFix: log in again or refresh the tokenIdentity known (or not needed), access refusedIAM or bucket policy, WAF, RBAC, IP allow-listFix: change permissions; logging in again will nothelp
Figure 1. 401 and 403 are not the same. 401 asks who you are; 403 knows and still says no.
Swipe sideways to see all of it, or tap to open it full screen.

4xx and SLOs

4xx responses are mostly client mistakes, so they're usually excluded from availability SLOs — otherwise a buggy client could burn your error budget. Exceptions to watch: 429s caused by your own throttling (your capacity problem), sudden 401/403 spikes after a deploy (auth misconfiguration), and 404 spikes (broken routes or links).