Understanding HTTP Response Codes

Demystifying HTTP Response Codes: A Comprehensive Guide to Web Communication Status

Rakesh Kumar
Web Tech Journals
9 min readJul 19, 2024

--

Understanding HTTP Response Codes: Demystifying HTTP Response Codes: A Comprehensive Guide to Web Communication Status
Understanding HTTP Response Codes: Demystifying HTTP Response Codes: A Comprehensive Guide to Web Communication Status

HTTP response codes are standard responses provided by web servers on the Internet.

These codes help in identifying the status of the requested resource.

They are categorized into five classes, each represented by the first digit of the three-digit code.

  1. Informational responses (100199)
  2. Successful responses (200299)
  3. Redirection messages (300399)
  4. Client error responses (400499)
  5. Server error responses (500599)

The status codes listed below are defined by RFC 9110.

Note: If you receive a response that is not in this list, it is a non-standard response, possibly custom to the server’s software.

1. Informational Responses (1xx)

Informational response codes indicate that the request has been received and the process is continuing.

100 Continue

  • Meaning: The initial part of a request has been received, and the client should continue with the request.
  • Use Case: Used to inform the client to send the request body after initial headers are received and validated by the server.

101 Switching Protocols

  • Meaning: The server is switching to the protocol requested by the client.
  • Use Case: Typically used in WebSocket upgrades.

102 Processing (WebDAV)

  • Meaning: The server has received and is processing the request, but no response is available yet.
  • Use Case: Prevents the client from timing out when the server is processing a request that might take a long time.

103 Early Hints

  • Meaning: Used to return some response headers before the final HTTP message.
  • Use Case: Helps improve performance by allowing the client to start preloading resources while waiting for the final response.

2. Successful Responses (2xx)

Successful response codes indicate that the request was successfully received, understood, and accepted.

200 OK

  • Meaning: The request has succeeded.
  • Use Case: Most common response for successful HTTP requests.

201 Created

  • Meaning: The request has been fulfilled, resulting in the creation of a new resource.
  • Use Case: Used after a POST request to indicate a new resource has been created.

202 Accepted

  • Meaning: The request has been accepted for processing, but the processing is not complete.
  • Use Case: Used for asynchronous processing where the request is accepted but not immediately processed.

203 Non-Authoritative Information

  • Meaning: The request was successful, but the response contains modified data from a third-party.
  • Use Case: Used when a proxy server modifies the response.

204 No Content

  • Meaning: The server successfully processed the request, but is not returning any content.
  • Use Case: Used when the server doesn’t need to return any content, such as after updating a resource.

205 Reset Content

  • Meaning: The server successfully processed the request and asks the client to reset the document view.
  • Use Case: Used when the server wants the client to reset the form or view after a successful PUT or POST request.

206 Partial Content

  • Meaning: The server is delivering only part of the resource due to a range header sent by the client.
  • Use Case: Used for resuming interrupted downloads or fetching specific parts of a document.

207 Multi-Status (WebDAV)

  • Meaning: The message body contains multiple status codes.
  • Use Case: Used to convey multiple status codes for multiple operations.

208 Already Reported (WebDAV)

  • Meaning: The members of a DAV binding have already been enumerated in a previous reply.
  • Use Case: Avoids enumerating the internal members of multiple bindings to the same collection repeatedly.

226 IM Used

  • Meaning: The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
  • Use Case: Indicates the server has applied a delta encoding to the response body.

3. Redirection Messages (3xx)

Redirection response codes indicate that further action needs to be taken by the user agent to fulfill the request.

300 Multiple Choices

  • Meaning: Indicates multiple options for the resource from which the client may choose.
  • Use Case: Can be used to present different formats of the same resource.

301 Moved Permanently

  • Meaning: The resource has been moved to a new URL permanently.
  • Use Case: Used to indicate URL changes.

302 Found

  • Meaning: The resource resides temporarily under a different URL.
  • Use Case: Commonly used for temporary URL redirection.

303 See Other

  • Meaning: The response to the request can be found under a different URL and should be retrieved using a GET method.
  • Use Case: Used to redirect after a POST request.

304 Not Modified

  • Meaning: Indicates that the resource has not been modified since the last request.
  • Use Case: Used to reduce bandwidth by not sending identical data.

305 Use Proxy (deprecated)

  • Meaning: The requested resource must be accessed through a proxy.
  • Use Case: Deprecated due to security concerns.

306 Switch Proxy (deprecated)

  • Meaning: No longer used; reserved for future use.
  • Use Case: Initially meant to indicate that the client should switch to a proxy.

307 Temporary Redirect

  • Meaning: The resource resides temporarily under a different URL but the request method should not be changed.
  • Use Case: Similar to 302, but method remains unchanged.

308 Permanent Redirect

  • Meaning: The resource has been moved to a new URL permanently, and the request method should not be changed.
  • Use Case: Similar to 301 but method remains unchanged.

4. Client Error Responses (4xx)

Client error response codes indicate that the client seems to have made an error.

400 Bad Request

  • Meaning: The server cannot or will not process the request due to a client error.
  • Use Case: Commonly used when the request has invalid syntax or is impossible to fulfill.

401 Unauthorized

  • Meaning: The request requires user authentication.
  • Use Case: Used when authentication is required and has failed or has not been provided.

402 Payment Required

  • Meaning: Reserved for future use.
  • Use Case: Initially intended for digital payment systems.

403 Forbidden

  • Meaning: The server understood the request but refuses to authorize it.
  • Use Case: Used when the user does not have permission to access the resource.

404 Not Found

  • Meaning: The requested resource could not be found.
  • Use Case: Commonly used when the resource does not exist.

405 Method Not Allowed

  • Meaning: The request method is known by the server but has been disabled and cannot be used.
  • Use Case: Used when a method is not supported by the resource.

406 Not Acceptable

  • Meaning: The server cannot produce a response matching the list of acceptable values defined in the request’s headers.
  • Use Case: Used for content negotiation.

407 Proxy Authentication Required

  • Meaning: The client must first authenticate itself with the proxy.
  • Use Case: Used when authentication is required to access a resource through a proxy.

408 Request Timeout

  • Meaning: The server timed out waiting for the request.
  • Use Case: Used when a request takes too long to complete.

409 Conflict

  • Meaning: The request could not be processed because of conflict in the current state of the resource.
  • Use Case: Used for resource version conflicts.

410 Gone

  • Meaning: The resource requested is no longer available and will not be available again.
  • Use Case: Used for resources that have been permanently deleted.

411 Length Required

  • Meaning: The request did not specify the length of its content, which is required by the requested resource.
  • Use Case: Used when content length is required but not specified.

412 Precondition Failed

  • Meaning: The server does not meet one of the preconditions that the requester put on the request.
  • Use Case: Used for conditional requests.

413 Payload Too Large

  • Meaning: The request is larger than the server is willing or able to process.
  • Use Case: Used when the payload size exceeds server limits.

414 URI Too Long

  • Meaning: The URI provided was too long for the server to process.
  • Use Case: Used when the request URI is longer than the server is willing to interpret.

415 Unsupported Media Type

  • Meaning: The request entity has a media type which the server or resource does not support.
  • Use Case: Used when the media type is not supported by the server.

416 Range Not Satisfiable

  • Meaning: The client has asked for a portion of the file but the server cannot supply that portion.
  • Use Case: Used for invalid range requests.

417 Expectation Failed

  • Meaning: The server cannot meet the requirements of the Expect request-header field.
  • Use Case: Used when expectations cannot be met.

418 I’m a teapot (RFC 2324)

  • Meaning: This code was defined in 1998 as one of the traditional IETF April Fools’ jokes.
  • Use Case: Used as an Easter egg and should not be implemented by real HTTP servers.

421 Misdirected Request

  • Meaning: The request was directed at a server that is not able to produce a response.
  • Use Case: Used for misdirected requests.

422 Unprocessable Entity (WebDAV)

  • Meaning: The request was well-formed but was unable to be followed due to semantic errors.
  • Use Case: Used for validation errors.

423 Locked (WebDAV)

  • Meaning: The resource that is being accessed is locked.
  • Use Case: Used when a resource is locked and cannot be modified.

424 Failed Dependency (WebDAV)

  • Meaning: The request failed due to failure of a previous request.
  • Use Case: Used when a request is dependent on another action that failed.

425 Too Early

  • Meaning: Indicates that the server is unwilling to risk processing a request that might be replayed.
  • Use Case: Used to prevent replay attacks.

426 Upgrade Required

  • Meaning: The client should switch to a different protocol.
  • Use Case: Used to enforce protocol upgrades.

428 Precondition Required

  • Meaning: The origin server requires the request to be conditional.
  • Use Case: Used to prevent the “lost update” problem.

429 Too Many Requests

  • Meaning: The user has sent too many requests in a given amount of time.
  • Use Case: Used for rate limiting.

431 Request Header Fields Too Large

  • Meaning: The server is unwilling to process the request because its header fields are too large.
  • Use Case: Used when header fields exceed server limits.

451 Unavailable For Legal Reasons

  • Meaning: The resource is unavailable for legal reasons.
  • Use Case: Used when the resource has been censored.

5. Server Error Responses (5xx)

Server error response codes indicate that the server failed to fulfill a valid request.

500 Internal Server Error

  • Meaning: The server encountered an unexpected condition that prevented it from fulfilling the request.
  • Use Case: Used for generic server errors.

501 Not Implemented

  • Meaning: The server does not support the functionality required to fulfill the request.
  • Use Case: Used when the server cannot recognize the request method.

502 Bad Gateway

  • Meaning: The server received an invalid response from the upstream server.
  • Use Case: Used for gateway or proxy errors.

503 Service Unavailable

  • Meaning: The server is currently unable to handle the request due to temporary overload or maintenance.
  • Use Case: Used for temporary server unavailability.

504 Gateway Timeout

  • Meaning: The server did not receive a timely response from an upstream server.
  • Use Case: Used for gateway or proxy timeout errors.

505 HTTP Version Not Supported

  • Meaning: The server does not support the HTTP protocol version used in the request.
  • Use Case: Used for unsupported HTTP versions.

506 Variant Also Negotiates

  • Meaning: The server has an internal configuration error: transparent content negotiation for the request results in a circular reference.
  • Use Case: Used for negotiation errors.

507 Insufficient Storage (WebDAV)

  • Meaning: The server is unable to store the representation needed to complete the request.
  • Use Case: Used for storage capacity issues.

508 Loop Detected (WebDAV)

  • Meaning: The server detected an infinite loop while processing a request.
  • Use Case: Used for loop detection.

510 Not Extended

  • Meaning: Further extensions to the request are required for the server to fulfill it.
  • Use Case: Used when additional extensions are needed.

511 Network Authentication Required

  • Meaning: The client needs to authenticate to gain network access.
  • Use Case: Used for network authentication issues.

Conclusion

Understanding HTTP response codes is essential for building reliable web applications.

These codes facilitate clear communication between clients and servers, indicating the status of requests and guiding necessary actions.

From successful completions to client and server errors, each code helps diagnose and address issues efficiently.

By mastering these codes, you can enhance your debugging skills and improve overall user experience, ensuring your web applications run smoothly.

Thank you so much for taking the time to read my article all the way through!

If you found it helpful or interesting, why not give it a round of applause by clicking those clap buttons?

Empowering web enthusiasts one bye at a time, simplifying the digital journey for all. By https://rakeshkumar-42819.medium.com

And hey, don’t miss out on more insightful content — hit that follow button to stay updated!

Get email alerts for my latest Medium posts! Click here.

Let’s learn and grow together. Happy Coding! 👏

--

--

Rakesh Kumar
Web Tech Journals

Skilled in frontend and backend development, I create robust solutions following best practices, ensuring compliance, and considering future perspectives.