HTTP Status Code Reference

Every registered HTTP status code, plus the unofficial ones you'll meet in nginx, Cloudflare and AWS logs. Search by number, name or problem (redirect, rate limit, timeout, auth), then open a code to see when to use it, what usually causes it and which headers go with it.

The five classes of HTTP status codes

The first digit of a status code tells you its class, and a client that doesn't recognise a specific code must treat it as the x00 code of that class. An unknown 479 is handled like 400, and an unknown 599 like 500.

Choosing status codes for a REST API

Most APIs only need about a dozen codes. Use them consistently and put the details in a machine-readable error body, for example application/problem+json from RFC 9457 with type, title, status and detail fields.

Common confusions

Status codes on AWS

On AWS, the component returning a code is often not your application. A 502, 503 or 504 from an Application Load Balancer, API Gateway or CloudFront usually points to a timeout, health check or TLS setting rather than a bug. Check the response headers (x-amzn-ErrorType, x-amz-cf-id, Server: awselb/2.0) and the service's access logs to see which layer produced the code. The elb_status_code and target_status_code fields in ALB logs separate the load balancer's code from your target's. S3 is a special case: a missing object returns 403 AccessDenied instead of 404 when the caller lacks s3:ListBucket, so S3 doesn't leak which keys exist.

Which responses are cacheable by default?

RFC 9110 lists the codes that caches may store heuristically, without explicit freshness information: 200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414 and 501. Any other code is cached only when the response carries Cache-Control or Expires. This is why a mistaken 301 can stick in browsers long after you fix the server. CDNs add their own rules: CloudFront, for example, caches some 4xx and 5xx errors for 10 seconds by default (the error caching minimum TTL).