Writing in the front
HTTP status code is a necessary knowledge for clients and servers, and often appears in the interview questions of some companies. This article briefly introduces the knowledge of HTTP status code.
Some of the most common HTTP status codes
- 200 – The request succeeded when the client receives the return from the server
"status:200"
When, say youGET/POST
Request successful - 301 – Resources are permanently transferred to others
URL
- 302 – Resources are temporarily transferred to others
URL
- 403 – Server rejects client request
- 404 – The requested resource does not exist. 404 is used when the server does not know which resource the client is requesting
- 500 – Internal server error
- 503 – The server is unavailable. The server is currently unavailable
- 504 – The proxy server acting as the gateway did not get the request from the remote server in time
HTTP status code classification
The HTTP status code consists of three decimal digits. The first decimal digit defines the type of the status code, and the second two digits do not classify. HTTP status codes are classified into five types: HTTP status code classification
classification | describe |
---|---|
1 * * | Message, the server receives the request and requires the requester to proceed with the operation |
2 * * | Success, the operation is received and processed successfully |
3 * * | Redirect, requiring further action to complete the request |
4 * * | Client error, request contains syntax error or request cannot be completed |
5 * * | Server error. The server encountered an error while processing the request |
Total HTTP status code table
Status code | Status code English name | Product description |
---|---|---|
100 | Continue | To continue. The client should continue with its request |
101 | Switching Protocols | Switch protocol. The server switches protocols based on client requests. You can only switch to a more advanced protocol, for example, the new version of HTTP |
200 | OK | The request succeeded. Typically used for GET and POST requests |
201 | Created | Has been created. The new resource was successfully requested and created |
202 | Accepted | Has been accepted. The request has been accepted, but processing is not complete |
203 | Non-Authoritative Information | Unauthorized information. The request succeeded. The meta information returned is not the original server, but a copy |
204 | No Content | No content. The server processed successfully, but refused to return the contents of the GET/POST request. That is, the server can return this response code for a GET/POST request, which means “the resource requested by the client exists, but its representation is empty.” You can ensure that the browser continues to display the current document without updating the web page |
205 | Reset Content | Reset the content. The server is successful, and the user end (for example, browser) should reset the document view. Use this return code to clear the browser’s form field |
206 | Partial Content | Part of the content. The server successfully processed some of the GET requests |
300 | Multiple Choices | A variety of options. The requested resource can include multiple locations, and a list of resource characteristics and addresses can be returned for user terminal (e.g., browser) selection |
301 | Moved Permanently | Permanently move. The requested resource has been permanently moved to the new URI, the return message will include the new URI, and the browser will automatically redirect to the new URI. Any future new requests should be replaced with a new URI |
302 | Found | Temporary move. Similar to 301. But resources are moved only temporarily. The client should continue to use the original URI |
303 | See Other | Look at other addresses. Similar to 301. Use GET and POST requests to view |
304 | Not Modified | Unmodified. The requested resource is not modified, and the server does not return any resources when it returns this status code. Clients typically cache accessed resources by providing a header indicating that the client wants to return only resources that have been modified after a specified date |
305 | Use Proxy | Use a proxy. The requested resource must be accessed through a proxy |
306 | Unused | An invalid HTTP status code |
307 | Temporary Redirect | Temporary redirect. Similar to 302. Use GET to request redirection |
400 | Bad Request | Client request syntax error, server cannot understand |
401 | Unauthorized | The request requires user authentication |
402 | Payment Required | Reserved for future use |
403 | Forbidden | The server understands the request from the requesting client, but refuses to execute the request |
404 | Not Found | The server could not find the resource (web page) based on the client’s request. With this code, a web designer can set up a personalized page that says “the resource you requested could not be found. |
405 | Method Not Allowed | The method in the client request is disabled. Check to see if the request is made in the wrong way |
406 | Not Acceptable | The server could not complete the request based on the content nature of the client request |
407 | Proxy Authentication Required | The request requires the identity of the broker, similar to the 401, but the requester should use the broker for authorization |
408 | Request Time-out | The server waited for a request sent by the client for a long time and timed out. Procedure |
409 | Conflict | This code may be returned when the server completes a PUT request from the client, and a conflict occurred when the server processed the request |
410 | Gone | The resource requested by the client does not exist. 410 differs from 404 in that the 410 code can be used if the resource previously had and is now permanently deleted. 410 is used when the server knows that the resource requested by the client once existed but no longer exists. |
411 | Length Required | The server cannot process the content-length message sent by the client |
412 | Precondition Failed | A prerequisite error occurred when the client requested information |
413 | Request Entity Too Large | The request was rejected because the requested entity was too large for the server to process. To prevent continuous requests from clients, the server may close the connection. If the server is temporarily unable to process it, a retry-after response is included |
414 | Request-URI Too Large | The request URI is too long (usually a url) for the server to process |
415 | Unsupported Media Type | The server could not process the media format attached to the request |
416 | Requested range not satisfiable | The scope requested by the client is invalid |
417 | Expectation Failed | The server cannot satisfy Expect’s request headers |
500 | Internal Server Error | The server had an internal error and could not complete the request |
501 | Not Implemented | The server did not support the requested functionality and could not complete the request |
502 | Bad Gateway | The server working as a gateway or proxy received an invalid response from the remote server when attempting to execute the request |
503 | Service Unavailable | The server is temporarily unable to process client requests due to overloading or system maintenance. The length of the delay can be included in the server’s retry-after header |
504 | Gateway Time-out | The server acting as a gateway or proxy did not get the request from the remote server in time |
505 | HTTP Version not supported | The server did not support the HTTP version of the request and could not complete the processing |