Mastering HTTP Status Codes: What Every Developer Should Know
This article provides a comprehensive overview of HTTP status codes—from informational 1xx responses to client‑error 4xx and server‑error 5xx codes—including the newer RFC 6585 codes, explaining their meanings and typical usage scenarios for developers.
Common HTTP Status Codes
Both backend and frontend developers encounter HTTP status codes; some of the most frequently seen are:
200 – Server successfully returns a web page
404 – Requested page does not exist
503 – Service unavailable
1xx (Informational)
These codes indicate a temporary response and that the client should continue the request.
100 (Continue) – The server has received the request headers and the client should send the request body.
101 (Switching Protocols) – The server agrees to switch protocols as requested by the client.
2xx (Success)
These codes indicate that the request was successfully processed.
200 (OK) – The request succeeded and the server returned the requested page.
201 (Created) – The request succeeded and a new resource was created.
202 (Accepted) – The request has been accepted for processing, but the processing is not complete.
203 (Non‑Authoritative Information) – The request succeeded but the information may come from a third‑party source.
204 (No Content) – The request succeeded but there is no content to send in the response.
205 (Reset Content) – The request succeeded; the client should reset the document view.
206 (Partial Content) – The server is delivering only part of the resource due to a range header.
3xx (Redirection)
These codes indicate that further action is needed to complete the request, typically a redirection.
300 (Multiple Choices) – The server can provide several options for the client to choose.
301 (Moved Permanently) – The requested resource has been permanently moved to a new URL.
302 (Found) – The resource resides temporarily under a different URL.
303 (See Other) – The client should retrieve the resource using a GET request at another URI.
304 (Not Modified) – The resource has not changed since the last request.
305 (Use Proxy) – The client must use a proxy to access the resource.
307 (Temporary Redirect) – The request should be repeated with another URI, but future requests can still use the original URI.
4xx (Client Error)
These codes indicate that the request contains bad syntax or cannot be fulfilled.
400 (Bad Request) – The server could not understand the request due to invalid syntax.
401 (Unauthorized) – Authentication is required and has failed or not been provided.
403 (Forbidden) – The server refuses to fulfill the request.
404 (Not Found) – The server cannot find the requested resource.
405 (Method Not Allowed) – The request method is not supported for the requested resource.
406 (Not Acceptable) – The requested resource is capable of generating only content not acceptable according to the Accept headers.
407 (Proxy Authentication Required) – Similar to 401 but authentication must be done with a proxy.
408 (Request Timeout) – The server timed out waiting for the request.
409 (Conflict) – The request could not be completed due to a conflict with the current state of the resource.
410 (Gone) – The resource is permanently removed.
411 (Length Required) – The request did not specify the length of its content.
412 (Precondition Failed) – The server does not meet one of the preconditions that the client put on the request.
413 (Payload Too Large) – The request entity is larger than the server is willing or able to process.
414 (URI Too Long) – The URI provided was too long for the server to process.
415 (Unsupported Media Type) – The request entity has a media type which the server or resource does not support.
416 (Range Not Satisfiable) – The client has asked for a portion of the file, but the server cannot supply that portion.
417 (Expectation Failed) – The server cannot meet the requirements of the Expect request-header field.
5xx (Server Error)
These codes indicate that the server failed to fulfill a valid request.
500 (Internal Server Error) – The server encountered an unexpected condition.
501 (Not Implemented) – The server does not support the functionality required to fulfill the request.
502 (Bad Gateway) – The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
503 (Service Unavailable) – The server is currently unable to handle the request due to temporary overload or maintenance.
504 (Gateway Timeout) – The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
505 (HTTP Version Not Supported) – The server does not support the HTTP protocol version used in the request.
Newer Status Codes (RFC 6585)
Four additional status codes have been introduced to address modern use cases.
428 Precondition Required – The request must be conditional; the client should include appropriate precondition headers such as If-Match or If-None-Match.
429 Too Many Requests – The client has sent too many requests in a given amount of time; a Retry-After header should be included.
431 Request Header Fields Too Large – The request headers are too large for the server to process.
511 Network Authentication Required – The client needs to authenticate to gain network access, often seen in captive‑portal Wi‑Fi scenarios.
Understanding these codes helps developers design robust RESTful services and handle client interactions correctly.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
