HTTP Common Status Codes
The duty of a status code is to describe the return request result when the client sends a request to the server. With the status code, the user can know whether the server has handled the request properly, or what error has occurred.
RFC2616 defines the status code, consisting of 3 digits and reason SMS.
The first digit in the number specifies the response category, and the latter two bits are not categorized. The following five types of response are available:
Type |
Reason-phrase |
Note (description) |
1XX |
Informational |
Indicates the message that the request was accepted and continues processing |
2XX |
Success |
Success status code, indicating that the request has been successfully accepted, understood |
3XX |
Redirection |
Redirect status code, indicating that further action is required to complete the request |
4XX |
Client Error |
Client Error status code indicating that the request has a syntax error or the request could not be implemented |
5XX |
Server Error |
Service-side Error status code indicating that the server failed to implement a legitimate request |
2XX Success
This class of status code indicates, the client's request was successfully received, understood, and accepted.
The result of the 2XX response indicates that the request from the client is handled properly on the server side.
$ OK (Request succeeded)
Requests are processed successfully, and the server returns results based on different request methods:
Get: The corresponding resource for the request is returned as a response.
Head: The response header of the requested corresponding resource is returned as a response, not including the response body.
POST: Returns the result of processing the corresponding request
3XX Redirection (redirected)
301 Movied Permanently (permanent redirect)
The status code indicates that the requested resource has been assigned a new URL, and later uses the URL that the resource now refers to.
4XX Client Error
The 4xx class of status code is intended for cases in which the client seems to has erred.
The response of 4XX indicates that the client is the cause of the error.
Request
The client request has a syntax error and cannot be understood by the server. The client needs to modify the requested content and send the request again.
401 Unauthorized (Request without permission)
Requests to be sent require authentication information that is authenticated by HTTP
403 Forbidden
The server receives the request, but refuses to provide the service,
404 Not Found
The requested resource does not exist, or the wrong URL address is entered
5XX Server Error
Indicates that the server itself is sending an error, or that there is insufficient capacity to process the request.
Internal Server Errorr (server sends unexpected error)
The server has an error executing the request.
503 Service Unavailable
The server is temporarily overloaded or is being shut down for maintenance and is now unable to process requests. (The server is currently unable to process client requests and may recover after some time)
Common HTTP status Codes