2XX(Success Status code)

The result of the 2XX response indicates that the request was processed normally

200 OK

Indicates that the request from the client is processed on the server

In the response message, the information returned with the status code will change depending on the method. For example, when the GET method is used, the entity of the requested resource is returned as a response. When the HEAD method is used, the entity HEAD of the requested resource is not returned along with the body of the message.

204 No Content

The status code indicates that the request received by the server is successfully processed, but the response packet returned does not contain the body part of the entity. Also, it is not allowed to return the body of any entity. For example, when a 204 response is returned after processing a request from the browser, the page displayed by the browser is not updated.

This is usually used when only information needs to be sent from the client to the server, and no new information content needs to be sent to the client

206 Partial Content

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

3XX(Redirection status code)

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

301 Moved Permanently

Permanent redirection

This status code indicates that the requested resource has been assigned a new URI and that the URI to which the resource now refers should be used later. That is, if the URI corresponding to the resource is already bookmarked, it should be saved again as indicated in the Location header field

302 Found

Temporary redirection

This status code indicates that the requested resource has been assigned a new URI and is expected to be accessed by the user using the new URI. Similar to 301 Moved Permanently, but the resource represented by the 302 status code is not Permanently Moved, but only temporarily. In other words, the URI of a resource that has been moved may change in the future. For example, the user saves the URI as a bookmark, but does not update the bookmark as if the 301 status code were present, but retains the URI of the page that returns the 302 status code.

303 See Other

This status code indicates that because another URI exists for the requested resource, the GET method should be used to GET the requested resource.

The 303 status code has the same functionality as the 302 Found status code, but differs from the 302 status code in that the 303 status code explicitly states that the client should use the GET method to obtain the resource. For example, when a CGI program is accessed using the POST method and the result is that the client is expected to redirect to another URI using the GET method, the 303 status code is returned. While the 302 Found status code can do the same thing, the 303 status code is ideal here

When the 301, 302, and 303 response status codes are returned, almost all browsers change POST to GET and delete the body of the request message, and the request is automatically sent again. 301, 302 Standard forbids changing POST to GET, but in practice this is what people do

304 Not Modified

This status code indicates the condition that the server allows the request to access the resource when the client sends a conditional request, but the condition is not met. The 304 status code returned does not contain any response body. 304 is still classified in the 3XX category, but has nothing to do with redirection.

A conditional request packet that uses the GET method contains any of if-match, if-modified-since, if-none-match, if-range, or if-unmodified-since headers

307 Temporary Redirect

Temporary redirect. The status code 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 will comply with browser standards and will not change from POST to GET. However, each browser may differ in how it behaves when handling the response

4XX(Client Error Client Error status code)

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

400 Bad Request

The status code indicates that a syntax error exists in the request packet. When an error occurs, you need to modify the content of the request and send the request again. In addition, the browser treats the status code as if it were 200 OK.

401 Unauthorized

The status code indicates that the request must be authenticated through HTTP (BASIC authentication or DIGEST authentication). In addition, if the user has been requested once before, the user authentication fails

A response returned with 401 must contain a WWW-authenticate first challenge user information applicable to the requested resource. When the browser receives the 401 response for the first time, an authentication dialog will pop up

403 Forbidden

This status code indicates that access to the requested resource was denied by the server. It is not necessary for the server to give a detailed reason for the rejection, but if it is desired, the reason can be described in the body of the entity so that the user can see it

The reasons for 403 May be that the file system is not authorized to access the file system, or that the access permission is incorrect (an unauthorized sending source IP address attempts to access the file system)

404 Not Found

This status code indicates that the requested resource could not be found on the server. In addition, it can be used when the server rejects the request without giving a reason

405 Method Not Allowed

This status code indicates that the method requested by the client is recognized by the server, but the server forbids it

GET and HEAD methods, which the server should always allow the client to access

The client can use the OPTIONS method to view the access methods allowed by the server, as shown below

Access - Control - Allow - the Methods to GET, HEAD, PUT, PATCH, POST, DELETE

Copy the code

5XX(Server Error Server Error status code)

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

500 Internal Server Error

This status code indicates that an error occurred on the server side while executing the request. It could also be a Web application bug or some temporary glitch

502 Bad Gateway

This status code indicates that the server acting as a gateway or proxy received an invalid response from the upstream server

Error 502 is usually not fixed by the client, but needs to be fixed by the path’s Web server or proxy server

503 Service Unavailable

This status code indicates that the server is temporarily overloaded or is down for maintenance and is unable to process requests at this time. If you know in advance how long this will take, it is best to write the RetryAfter header field and return it to the client

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

reference

  • The illustration of HTTP
  • MDN Web Doc

The statement

The images used in this article are from the graphic HTTP, if any infringement, please know