When we send the request from the client to the server, the server returned a status code to us, a status code is to tell us the server response, through it, we can know the current request is successful or what is wrong with a status code consists of three Numbers and reason phrase The first digit said response categories, response divided into five categories from 1 to 5

Status code Response type
1XX Informational status code
2XX Success status code
3XX Redirection status code
4XX Client error status code
5XX Server error status code

2XX

200 OK

The request is processed by the server

The information returned with this status code is relevant to your request method

For a GET request, the requested resource is returned as a response entity

In a HEAD request, the information exists only at the HEAD of the response message, because it does not return the entity

204 No Content

Indicates that the request was processed successfully, but no content is returned

That is, the response message is returned with no entity.

206 Partial Content

Indicates that the server has completed part of the GET request (the client has made a scope request)

3 xx redirection

301 Moved Permanently

Permanent redirect: indicates that the requested resource has been permanently moved to another location

The resource has been assigned a new URL

The new URL should prompt in the Location header field of the response message

302 Found

Temporary redirect, which indicates that the requested resource is temporarily moved to another location

The requested resource is temporarily assigned to a new URL

It is similar to 301, except that resources are moved temporarily and may change in the future

Similarly, the new temporary URL should prompt in the header field of the Location of the response message

303 See Other

Indicates that another URI exists for the requested resource and should be directed to obtain the requested resource using GET

303 functions the same as 302, except that 303 specifies that the client should use GET access

(Many browsers prior to HTTP/1.1 did not understand 303, but everyone treated 302 as 303 and used GET to request new URIs.)

304 Not Modified

The client sends a conditional request (IF…). , the condition is not met

When 304 is returned, no response body is included

Although 304 is classified in 3XX, it has nothing to do with redirection

307 Temporary Redirect

Temporary redirect, which has the same meaning as 302

Despite the 302 standard forbidding POST to become GET, no one listened to him

307 will follow the standard and not change from POST to GET

However, the response behavior may vary from browser to browser

4XX Client error

400 Bad Request

Syntax errors or parameter errors exist in the request packet and the server does not understand them

The server should not re-submit this request

You need to modify the request and send it again

401 Unauthorized

Indicates that the sent request requires HTTP authentication information or that authentication failed

The response returning 401 must include a WWW-Authenticate header applicable to the requested resource to challenge the user information

When the browser accepts 401 for the first time, the authentication window pops up

403 Forbidden

Indicates that access to the requested resource was denied by the server

The server may or may not explain this

You can describe the reason in the body of the response entity if you want to

You may not have access, for example

404 Not Found

The server could not find the resource you requested

Or maybe the server just doesn’t want to give it to you and tricks you into not finding it (⊙ˍ⊙)

And that’s how most servers play with the status code

5XX Server error

500 Internal Server Error

An error occurred when the server executed the request

The Web application may be buggy or temporarily faulty

It’s more likely that the server source code is buggy…

503 Service Unavailable

Indicates that the server is overloaded or down for maintenance and cannot process requests

If the server knows how long it will take, it writes retry-after to the header field and returns

conclusion

The status code returned is inconsistent with the status, which can occur, such as an internal Web application error, but still returns 200 OK

206 Partial Content GET Scope request was successfully processed 301 Moved Permanently redirected Permanently, Resources have been permanently assigned new URI 302 Found temporary redirection, resources have been temporarily assigned new URI 303 See Other temporary redirection, 307 Temporary Redirect The request sent by 304 Not Modified is Not met. 401 Unauthorized The Request requires HTTP authentication. 404 Not Found The requested resource cannot be Found (the Server rejects the request without any reason) 500 Internal Server Error The Server is faulty or the Web application is faulty 503 Service Unavailable The server is overloaded or down for maintenanceCopy the code