7 min read

HTTP Status Codes Explained

A practical guide to HTTP status code classes and the codes you meet most often, including the 401 vs 403 and 502 vs 504 differences.

Five classes

1xx responses are informational. 2xx means the request succeeded. 3xx tells the client to look elsewhere. 4xx means the request itself has a problem. 5xx means the server failed to handle a valid request.

Success and redirects

200 OK is the general success response; 201 Created is used when a resource was created; 204 No Content when there is nothing to return. 301 is a permanent redirect that search engines follow and transfer signals through; 302 and 307 are temporary. 304 Not Modified tells a client its cached copy is still valid.

Client errors that confuse people

401 Unauthorized actually means unauthenticated: credentials are missing or invalid. 403 Forbidden means the server knows who you are but you are not allowed. 404 means the resource does not exist, 409 signals a conflict with current state, 422 a well-formed request with invalid content, and 429 that you are being rate limited.

Server errors

500 is an unhandled error in the application. 502 Bad Gateway means a proxy received an invalid response from the upstream server. 503 means the service is temporarily unavailable. 504 Gateway Timeout means the proxy gave up waiting for the upstream server.

Try the HTTP Status Codes