iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😺

HTTP Status Code List

に公開

Introduction

HTTP (Hypertext Transfer Protocol) status codes indicate whether an HTTP request has been successfully processed or if an error has occurred. These status codes play a crucial role in showing the communication state between the client and the server. Below is a list of major HTTP status codes.

HTTP status codes are divided into five classes, each carrying a different meaning. Understanding these codes makes web application development and debugging more efficient. They are also important for providing appropriate feedback to users.

I decided to create this article because I couldn't explain all the codes when I purchased the LINE stickers "HTTP Status Codes". Through these stickers, I hope you can gain a deeper understanding of the meanings and applications of HTTP status codes.

In this article, along with detailed explanations of each status code, I will introduce usage examples and related information. This will help developers quickly grasp the meaning of HTTP status codes they encounter daily and aid in problem-solving.

1xx Informational

These status codes are used for informational purposes. They indicate that the request has been received and processing is ongoing.

  • 100 Continue: The initial part of the request has been received, and the client may continue with the request. Usually used to check if the server is ready to accept a large amount of data before actually sending it.
  • 101 Switching Protocols: The request to switch protocols has been accepted. For example, this is returned when a request to switch from HTTP to WebSocket is successful.
  • 102 Processing: The request has been accepted and processing is continuing (WebDAV). This is used to prevent the client from timing out during long-running operations.

2xx Success

These status codes indicate that the request was successfully received, understood, and processed.

  • 200 OK: The request was successful, and the result is returned. For example, it is used as a normal response to a GET request.
  • 201 Created: The request was successful, and a new resource has been created. This is returned when a new resource is generated on the server via a POST request.
  • 202 Accepted: The request has been accepted but has not been processed yet. This is used when asynchronous processing is required.
  • 204 No Content: The request was successful, but there is no content to return. This is used for responses to DELETE requests where data is deleted, etc.

3xx Redirection

These status codes indicate that additional action is required for the request.

  • 300 Multiple Choices: There are multiple choices, and a decision must be made on which to use. For example, it is used when the same resource exists in different formats.
  • 301 Moved Permanently: The requested resource has been permanently moved. The browser automatically redirects to the new location.
  • 302 Found: The requested resource resides temporarily under a different URI. The browser automatically redirects to the new location, but the original URI is expected to be used.
  • 303 See Other: The response to the request can be obtained at a different URI. This is used, for example, when obtaining a new resource using the GET method after a POST method.
  • 304 Not Modified: The requested resource has not been modified. This instructs the browser to use the cached resource.
  • 307 Temporary Redirect: The resource resides temporarily under a different URI, but the same URI will be used in the future. The browser sends the new request to the new location using the same HTTP method.
  • 308 Permanent Redirect: The resource has been permanently moved to a different URI. The browser will use the new URI for future requests.

4xx Client Error

These status codes indicate an error on the client side.

  • 400 Bad Request: The server cannot understand the invalid request. It is returned for requests with invalid syntax.
  • 401 Unauthorized: A request for a resource that requires authentication. It is returned when appropriate authentication credentials are not provided.
  • 402 Payment Required: Reserved for future use (currently rarely used). It may be used for services that require payment.
  • 403 Forbidden: The server is refusing the request. It is returned when the user does not have access rights even if they have authentication credentials.
  • 404 Not Found: The requested resource cannot be found. It is returned for access to pages that do not exist.
  • 405 Method Not Allowed: The requested method is not allowed. It is returned when a resource does not support a specific method.
  • 406 Not Acceptable: The requested resource cannot be provided according to the Accept header. It is returned when the resource is not in a format acceptable to the client.
  • 408 Request Timeout: The server timed out waiting for the completion of the request. It is returned when the client took too long to send the request.
  • 409 Conflict: The request conflicts with the current state of the resource. It is returned when a conflict related to resource versioning occurs.
  • 410 Gone: The requested resource is permanently unavailable. It is returned when the resource has been deleted from the server.
  • 413 Payload Too Large: The request payload exceeds the capacity the server is capable of processing. It is returned for request bodies that are too large.
  • 417 Expectation Failed: The requirements of the Expect header could not be met by the server. It is returned when the server does not support the Expect request header.
  • 423 Locked: The resource is locked (WebDAV). It is returned for requests to a locked resource.
  • 426 Upgrade Required: The client needs to upgrade to a different protocol. It is returned when a newer protocol must be used.
  • 429 Too Many Requests: The client has sent too many requests in a given amount of time. It is returned when rate limiting is applied.

5xx Server Error

These status codes indicate an error on the server side.

  • 500 Internal Server Error: An internal server error. This is returned when an unexpected condition or error occurs.
  • 501 Not Implemented: The server does not have the functionality required to fulfill the request. This is returned for methods that the server does not support.
  • 502 Bad Gateway: An invalid response was received. This is returned when a gateway or proxy server receives an invalid response from an upstream server.
  • 503 Service Unavailable: The service is unavailable. This is returned when the server is temporarily overloaded or undergoing maintenance.
  • 504 Gateway Timeout: The gateway or proxy timed out waiting for a response from the upstream server. This is returned when the upstream server takes too long to respond.
  • 505 HTTP Version Not Supported: The server does not support the HTTP protocol version used in the request.

Discussion