Common http status codes (14 representative types)

2XX success
2XX response result indicates that the request was processed normally.

200 ok
request has been processed normally

204 No Content
request processed successfully! But there is no resource to return.
This status code means that the request received by the server has been successfully processed, but the response message returned does not contain the body of the entity. In addition, it is also not allowed to return the body of any entity. For example, when a request is sent from the browser and a 204 response is returned, the page displayed by the browser will not be updated.
Generally, it is only necessary to send information from the client to the server, and it is used when the client does not need to send new information content.

206 Partical Content
request for a certain part of the resource

This status code indicates that the client made a range request, and the server successfully executed this part of the GET request. The response message contains the entity content specified by Content-Range

The 3XX redirection
3XX response result indicates that the browser needs to perform some special processing to properly process the request.

301 Moved Permanently
Permanently redirected. This status indicates that the requested resource has been assigned a new URI, and the URI currently pointed to by the resource should be used in the future. In other words, if the URI corresponding to the resource has been saved as a bookmark,
then you should save it again according to the URI prompted by the Location header field.

302 Found
temporary redirection.
This status code indicates that the requested resource has been assigned a new URI, and it is hoped that the user (this time) can use the new URI to access it.
Similar to the 301 Moved Permanently status code, but the resource represented by the 302 status code is not permanently moved, but temporary. In other words, the URI corresponding to the moved resource may change in the future. For example, the user saves the
URI as a bookmark, but the bookmark will not be updated when the 301 status code appears, but the URI corresponding to the page that returns the 302 status code is still retained.

303 See Other
This status code indicates that because there is another URI for the resource corresponding to the request, the GET method should be used to obtain the requested resource.
The 303 status code and the 302 Found status code have the same function, but the 303 status code clearly indicates that the client uses the GET method to obtain resources, which is different from the 302 status code.
For example, when using the POST method to access a CGI program, the processing result after execution is that the client is expected to be redirected to another URI with the GET method, and the status code will be returned. Although the 302 Found status code can also achieve the same function,
it is ideal to use the 303 status code here.

304 Not Modified
This status code indicates that when the client sends a conditional request, the server allows the request to access the resource, but because the request does not meet the conditions, it directly returns 304 Not Modified (the server resource has not changed, and the client can be used directly Cache that has not expired at the end). When the 304 status code is returned, it does not contain any response body part. Although 304 is classified in the 3XX category, it has nothing to do with redirection.

307 Temporary Redirect
Temporary redirection. This status code has the same meaning as 302 Found. Although the 302 standard prohibits the conversion of POST to GET, it is not followed in actual use.
307 will comply with browser standards and will not change from POST to GET. However, there may be different situations in each browser for the behavior when processing the response.

4XX client error
4XX response result indicates that the client is the cause of the error.

400 Bad Request
This status code indicates that there is a syntax error in the request message. When an error occurs, you need to modify the content of the request and send the request again. Also, will the browser treat the status like 200 OK?

401 Unauthorized
This status code indicates that the request sent requires authentication information that has passed HTTP authentication (BASIC authentication, DIGEST authentication). In addition, if the request has been made once before, it means that the user authentication has failed.
The response containing 401 must contain a WWW-Authenticate header applicable to the requested resource to challenge the user's information. When the browser receives the 401 response for the first time, a dialog window for authentication will pop up.

403 Forbidden
This status code appears to be denied access to the requested resource by the server. The server side does not need to give a detailed reason for rejection, but if you want to explain, you can describe the reason in the body of the entity so that the user can see it.
Unauthorized access to the file system, some problems with access permissions (trying to access from an unauthorized sender IP address), etc. may all be the reasons for the occurrence of 403.

404 Not Found
This status code indicates that the server cannot find the requested resource. In addition, it can also be used when the server rejects the request and does not want to explain the reason.

5XX server error

The response of 5XX indicated that an error occurred in the server itself.

500 Internal Server Error
This status code indicates that an error occurred on the server side while executing the request. There may be a bug or some temporary malfunction in the web application.

503 Service Unavailable
This status code indicates that the server is temporarily overloaded or is shutting down for maintenance, and the request cannot be processed now. If you know the time required to resolve the above situation in advance, it is best to write the Retry-After header field and return to the client

The status code is inconsistent with the status
Many of the returned status code responses are wrong, but the user may not be aware of this. For example, if an error occurs inside the web application, the status code still returns 200 OK. This situation is often encountered.

Excerpted from Xuan Ueno, author of "Illustrated HTTP"

Guess you like

Origin blog.csdn.net/qq_26889291/article/details/109028205