HTTP · 2026-11-25 · 9 min

HTTP 4xx vs 5xx: Who Is Responsible?

Use the first digit of an HTTP status as a responsibility hint, then verify the request, edge, origin and upstream before assigning blame.

By Open Error Codes EditorialReviewed 2026-11-25

The first digit of an HTTP status is a responsibility hint: 4xx usually points at the request, 5xx at the server or an upstream dependency. The hint is useful, but it is not a verdict. A proxy can turn a valid request into a 403, and a client retry storm can push a healthy service into 503.

The short version

StatusUsual meaningFirst checkDo not assume
400Malformed syntax, body or parameterRequest body, Content-Type, schemaThat the server is broken
401Authentication missing or invalidAuthorization header, token expiryThat the account lacks permission
403Authenticated but not allowedRole, scope, policy, IP/WAFThat another login will fix it
404No resource at this URLPath, route, API versionThat the object was deleted
409State conflictVersion, idempotency key, current stateThat retrying the same write is safe
413Body too largePayload size, proxy limitThat compression fixes validation
415Unsupported media typeContent-Type, parser supportThat JSON is always accepted
429Rate limit or quotaRetry-After, usage, concurrencyThat rotating keys is appropriate
451Unavailable for legal reasonsPolicy, region, legal blockThat a network fix will help
500Unhandled server failureApplication log, request IDThat the client caused it
502Bad upstream responseGateway log, upstream healthThat the browser is at fault
503Temporarily unavailableDeploy, load, dependency, maintenanceThat a retry loop is harmless
504Upstream timed outGateway timeout, upstream latencyThat increasing timeout is always safe

4xx is about the request, but not always the client

A 400 often means the body does not match the schema. A 401 means the server does not accept the identity. A 403 means the identity is known but the action is denied. Those are different problems, and mixing them up leads to bad fixes: rotating a token will not fix a missing role, and adding a role will not fix an expired token.

A 404 is also easy to misread. The resource may exist in another environment, under another API version, or behind a route that was not registered on this host. A 404 should not be used to hide a permission failure; that makes debugging and monitoring worse.

Some 4xx responses are the server’s fault. A validation bug can reject a valid payload. A WAF rule can block a legitimate request. A proxy can rewrite the method and produce a 405. Treat 4xx as “the server refused this request”, not “the user is wrong”.

5xx is about the server, but the trigger can be the client

A 500 usually means the application failed after accepting the request. A 502 means a gateway could not use the upstream response. A 503 means the service is temporarily unable to handle the request. A 504 means the gateway waited for an upstream and gave up.

Clients can still contribute. A very large upload can exhaust a worker, a retry storm can amplify an outage, and a malformed request can trigger a server bug. The correct response is to stop the amplification first, then fix the server path.

A practical decision path

  1. Capture the status, method, URL and response body. Do not rely on the browser’s rendered error page alone.
  2. Read the response headers. Look for Retry-After, WWW-Authenticate, request IDs, CDN IDs and content type.
  3. For 4xx, compare the request with the schema. Check the exact field, method, content type and auth scope.
  4. For 5xx, check whether the request reached the application. If not, inspect the edge, proxy and upstream.
  5. Decide whether retrying is safe. Retry idempotent reads with backoff; do not blindly retry writes that may have succeeded.
  6. Escalate with evidence. Include the request ID, timestamp, status, response body and a minimal reproduction.

Commands that produce useful evidence

# Status, headers and a small body, without following redirects
curl -sS -D - -o /tmp/body.txt https://example.com/api/items

# Show the redirect chain
curl -sS -L -o /dev/null -w '%{http_code} %{url_effective}\n' https://example.com/old

# Repeat an idempotent request with backoff (example only)
curl --retry 3 --retry-delay 2 --retry-all-errors https://example.com/health

# Inspect DNS and TLS before blaming the application
dig +short example.com
openssl s_client -connect example.com:443 -servername example.com

Replace the host and path with your own. Keep the raw output; screenshots lose headers and request IDs.

When the boundary is misleading

CDNs, API gateways, service meshes and reverse proxies can generate statuses on behalf of someone else. A 502 from a gateway says the gateway could not use an upstream response; it does not prove the upstream is down. A 403 from a WAF says a policy blocked the request; it does not prove the application checked the user’s role.

Read the response body and the server-specific headers. If the body is an HTML error page from a proxy, the application may never have seen the request. If the body is a structured JSON error from the application, the request reached the application and the application made a decision.

What to record in a ticket

  • Method, URL, status and response body.
  • Request headers that affect routing or auth, with secrets removed.
  • Request ID, trace ID, timestamp and region.
  • Whether the request is idempotent and whether a retry is safe.
  • What changed: deploy, DNS, certificate, proxy rule, quota or client version.
  • The smallest request that reproduces the status.

Retry safety and idempotency

A status code does not tell you whether a retry is safe. That depends on the operation. A GET or HEAD is normally safe to retry. A PUT with a complete representation is usually idempotent. A POST may create a second order, payment or comment if the first request succeeded but the response was lost.

For writes, use an idempotency key when the API supports it, or reconcile the resource state before retrying. For 429 and 503, respect Retry-After and add jitter so that many clients do not retry at the same instant. For 500 and 502, retry only if the request is idempotent; otherwise ask the user or check the resource first.

StatusUsually retryable?Condition
408YesRequest was not fully received; safe for idempotent operations.
429YesAfter the reset window or Retry-After; reduce concurrency.
502 / 503 / 504SometimesOnly with backoff and an idempotency guarantee for writes.
500CarefullyServer may have partially applied the write.
400 / 401 / 403 / 404 / 415NoRetrying the same request usually repeats the same decision.

Status codes generated by proxies

A reverse proxy, CDN or service mesh can generate its own 4xx and 5xx responses. A 403 from a WAF is a policy decision at the edge, not necessarily an application permission check. A 502 from a gateway means the gateway could not use an upstream response; the upstream may still be healthy for other routes.

Look at response headers and body shape. Gateway errors often include a server name, a request ID or an HTML page that differs from the application’s JSON error format. If the application never saw the request, application logs will not contain the request ID. That absence is useful evidence, not a dead end.

Related code pages

Go deeper on the status you actually received: 400, 401, 403, 404, 409, 413, 415, 429, 451, 500, 502, 503 and 504. The HTTP product hub lists every published code with its source and verification date.

Sources

Search the code you are seeing

Every page links the official source and the date it was last checked.

Search codes