The HTTP status code is responsible for representing the return result of the CLIENT’S HTTP request, marking the normal processing of the server, and notifying the error.

4.1 Status code Indicates the result of the request returned from the server

The status code is responsible for describing the returned request results when the client sends a request to the server.

Three-digit number and reason phrase






4.2 2 xx success

The response from 2XX indicates that the request was processed normally.

2 200 OK



The HEAD method
Returns the first
The body of the entity is not returned


4.2.2 204 No Content

The request was processed successfully
No resources are returned


Holdings of 206 Partial Content

Scope of the request
Successful execution

4.3 3XX Redirection

The 3XX response results indicate that the browser needs to perform some special processing to properly handle the request.

Redirect refers to the use of various methods to Redirect network requests to other locations, such as web page redirection, domain name redirection, and routing changes. (Simply put, redirect to another address)

4.3.1 301 version Permanently


4.3.2 302 Found

Temporary redirection


301 and 302: common: both indicate redirection. The browser gets the status code and automatically redirects to A new URL that can be retrieved from the Location header of the response. 301 indicates that the resource at the old address has been permanently removed, that is, the address is no longer accessible. The search engine changes the old address to the redirected address while capturing new content. 302 indicates that the old address is still accessible, but only temporarily jumps from the old address to the redirected address. The search engine will fetch new content, but still retain the old address. Recommended reading: blog.csdn.net/ai2000ai/ar…

4.3.3 303 See Other

Use the GET method to GET the requested resource directionally


When the 301, 302, and 303 response status codes return, almost all browsers change POST to GET and remove the body of the request message, and the request is automatically sent again. Standards 301 and 302 forbid the use of GET instead of POST, but everyone does it in practice.

4.3.4 304 Not Modified

A conditional request
But the condition is not met
It has nothing to do with redirection

4.3.5 307 Temporary Redirect

Temporary redirection, which has the same meaning as 302 Found. Although the 302 standard forbids the conversion of POST to GET, it is not followed in practice. 307 obeys browser standards and does not change from POST to GET, but each browser may have different behavior for handling the response.

4.4 4XX Client Errors occur

The 4XX response results indicate that the client is the cause of the error.

4.4.1 400 Bad Request

A syntax error occurred in the request packet. Procedure

4.4.2 401 Unauthorized

The request must be authenticated through HTTP (BASIC authentication or DIGEST authentication)



WWW – Authenticate first
When the browser receives the 401 response for the first time, an authentication dialog will pop up.

4.4.3 403 Forbidden

Access to the requested resource was denied by the server

4.4.4 404 Not Found

Indicates that the requested resource cannot be found on the server.Can also beThe server rejects the request without giving a reason

4.5 5XX Server Error

The response from 5XX indicates an error occurred on the server itself.

4.5.1 500 Internal Server Error

An error occurred on the server side while executing the request
Bugs in Web applications
Some temporary glitches

4.5.2 of 503 Service Unavaliable

The server is temporarily overloaded or is being stopped for maintenance


Inconsistency between status code and condition Many status code responses returned are incorrect, but the user may not be aware of them. It is not uncommon for the status code to return 200 OK after an error occurs within a Web application.

! important

  • The status code is responsible for describing the returned request results when the client sends a request to the server.
  • A status code consists of three digits and a reason phrase. The first digit specifies the response category, and the last two digits are unclassified. See table 4-1.
  • 2XX: The request succeeded
    • 200 OK: The request from the client is processed on the server
    • 204 No Content: Processed successfully without returning any resources
    • 206 Partial Content: The client made a Partial Content request and the server executed it successfully
  • 3XX: Redirection (the browser needs to perform some special processing to properly process the request)
    • 301 Moved Permanently: Permanent redirection
    • 302 Found: Temporary redirection
    • 303 See Other: indicates a temporary redirect and specifies that the client should use the GET method to obtain resources
    • 304 Not Modified: The server allows the client to request access to the resource, but conditions are Not met
    • 307 Temporary Redirect: indicates a Temporary Redirect that does not change from POST to GET according to browser standards
  • 4XX: Client error
    • 400 Bad Request: Syntax errors exist in the Request packet
    • 401 Unauthorized: The request to be sent requires authentication information such as HTTP authentication
    • 403 Forbidden: Access to the requested resource is denied by the server
    • 404 Not Found: The requested resource could Not be Found on the server or the server rejected the request without giving a reason
  • 5XX: Server error
    • 500 Internal Server Error: An Error occurred when the Server performed the request
    • 503 Service Unavaliable: The server is temporarily overloaded or is being stopped for maintenance
  • Both 301 and 302 status codes indicate redirection. However, 301 indicates that the resource at the old address has been permanently removed, and the search engine will change the old address to the redirected address while retrieving new content. 302 will still retain the old address.