(+84) 873 827 2922
contact@digityze.asia

Định nghĩa các mã status

Bài học 1/2 | Thời gian học tập: 10 Phút
Định nghĩa các mã status

What Are HTTP Status Codes?

HTTP response codes are three-digit numbers generated by a server to respond to a browser’s request. The Internet Assigned Numbers Authority (IANA) maintains the official registry of all statuses.

The first digit defines the status code’s category, which begins with a number between one and five. For example, 1XX shows informational responses, while 5XX displays server error alerts.

On the other hand, the last two are assigned for specific information under a given classification. For example, 404 indicates that the server can’t find the requested resource.

HTTP defines request methods to indicate the desired action for a resource. Each implements a different semantic, but they have some common features, such as safe, idempotent, and cacheable. Here is the list:

  • GET – requests a specific resource representation and will only retrieve data.
  • HEAD – requests the same response as the GET method but without a message body.
  • POST – submits an entity to the specified resource, often changing the server’s state.
  • PUT – replaces all resource representations with the request payload.
  • DELETE – removes the specified response.
  • OPTIONS – explains the communication options for the resource.
  • TRACE – performs a message loop-back test along the path to the resource.
  • PATCH – applies partial modifications to a resource.

How Are HTTP Status Codes Categorized?

HTTP status codes have five categories based on the server responses sent to the browser:

  • 1XX informational – this class indicates that the server received the HTTP request sent by the browser and will continue the process. It is a temporary response, so the client won’t encounter this status code since it’s not the final answer.
  • 2XX success – this class indicates that the server received, understood, and processed the request. Subsequently, the browser accepts the expected information.
  • 3XX redirection – this class indicates that the server received the request, but the requested content was moved to a different location, so the client will be redirected.
  • 4XX client error – this class indicates that the server can’t complete the request because of a client-side error, such as an unavailable page, bad syntax, or authorization problem. The response will explain whether it is a temporary or permanent issue.
  • 5XX server error – this class indicates that the server encountered an error and can’t process a valid request. The response will describe the situation and determine whether it is a temporary or permanent problem.

A Complete List of HTTP Status Codes

Here is the complete list of HTTP status codes:

Status codeFunctions
1XX Informational
100Continue
101Switching Protocols
102Processing
103Early Hints
2XX Successful
200OK
201Created
202Accepted
203Non-Authoritative Information
204No Content
205Reset Content
206Partial Content
207Multi-Status
208Already Reported
226IM Used
3XX Redirection
300Multiple Choices
301Moved Permanently
302Found (Previously: Moved Temporarily)
303See Other
304Not Modified
305 (Unused)Previously: Use Proxy
306 (Unused)Previously: Switch Proxy
307Temporary Redirect
308Permanent Redirect
4XX Client Error
400Bad Request
401Unauthorized
402Payment Required
403Forbidden
404Not Found
405Method Not Allowed
406Not Acceptable
407Proxy Authentication Required
408Request Timeout
409Conflict
410Gone
411Length Required
412Precondition Failed
413Payload Too Large
414URI Too Long
415Unsupported Media Type
416Range Not Satisfiable
417Expectation Failed
418 (Unused)Previously: I’m a Teapot
421Misdirected Request
422Unprocessable Entity
423Locked
424Failed Dependency
425Too Early
426Upgrade Required
428Precondition Required
429Too Many Requests
431Request Header Fields Too Large
451Unavailable for Legal Reasons
5XX Server Error
500Internal Server Error
501Not Implemented
502Bad Gateway
503Service Unavailable
504Gateway Timeout
505HTTP Version Not Supported
506Variant Also Negotiates
507Insufficient Storage
508Loop Detected
510 (Unused)Not Extended
511Network Authentication Required