Introduction to http status codes, classification and detailed explanation of the meanings of common status codes

1: What does http status code mean?

HTTP status code (English: HTTP Status Code) is a 3-digit code used to indicate the response status of the web server's Hypertext Transfer Protocol. It is defined by the RFC 2616 specification and has been extended by RFC 2518, RFC 2817, RFC 2295, RFC 2774 and RFC 4918. The first digit of all status codes represents one of the five statuses of the response. The message phrases shown are typical, but any readable alternatives may be provided. Unless otherwise noted, status codes are part of the HTTP/1.1 standard (RFC 7231).

2: What is the use of http status code?

The core function of the http status code is used by the Web Server to tell the client what happened to the current web page request, or the response status of the current Web server. Therefore, HTTP status codes are often used to determine and analyze the current operating status of the web server.

Common http status codes:

200 - The server successfully returned the web page

404 - The requested web page does not exist

503 - Service unavailable

Three: Where to check http status code

1. Use F12 debugging of the browser (or right-click to check), and check the status of the network. Status is the status code returned by http.
Insert image description here

2. You can use online tools to check the HTTP status by entering the URL, such as Webmaster Home: https://tool.chinaz.com/pagestatus?url=blog.361s.cn
Insert image description here

Four: HTTP status code classification
HTTP status code consists of three decimal digits. The first decimal digit defines the type of status code. Responses are divided into five categories: information response (100–199), successful response (200–299), redirect (300–399), client error (400–499), and server error (500–599). 2xx means that the request
Insert image description here
has
been Successfully received, understood, and accepted by the server, common ones are:
200 OK (success): the request has been successful, the response header or data body expected by the request will be returned with this response
201 (created): the request is successful and the server has created it New resource
202 (Created): The server has received the request, but has not yet processed it.
203 (Unauthorized information): The server has successfully processed the request, but the information returned may come from another source.
204 No Content (no content): The server successfully processed it. Requested, but no content was returned
205 (Reset Content): The server successfully processed the request, but no content was returned
206 Patial Content (Partial Content): The server successfully processed part of the request

3xx
indicates that further action is required to complete the request. Usually, these status codes are used for redirects, common ones are:
300 (Multiple Choices): The server can perform multiple actions in response to the request. The server can select an action based on the requester (user agent), or provide a list of actions for the requester to choose from.
301 Moved Permanently: The requested web page has been permanently moved to a new location. When the server returns this response (in response to a GET or HEAD request), it automatically moves the requester to a new location.
302 (Temporary Move): The server is currently responding to the request from a page in a different location, but the requester should continue to use the original location. When making future requests
303 (View Other Locations): The requester should use separate GET requests to different locations to retrieve the response, the server returns this code 305
(Use Proxy): The requester can only use a proxy to access the requested web page. If the server returns this response, it also indicates that the requester should use proxy
307 (Temporary Redirect): The server is currently responding to the request from a web page in a different location, but the requester should continue to use the original location for future requests.

4xx
indicates that an error may have occurred on the client side, hindering the server's processing. Common ones are:
400 Bad Request: The server does not understand the syntax of the request.
401 Unauthorized: The request requires authentication. For web pages that require login, the server may return this response.
403 Forbidden: The server rejected the request
404 Not Found: The server could not find the requested web page
405 (Method Disabled): The method specified in the request is disabled
406 (Not Accepted): Unable to respond to the request with the requested content attributes 407 (Proxy Authorization Required
): This status code is similar to 401 (Not Authorized), but specifies that the requester should be authorized to use the proxy.
408 (Request Timeout): A timeout occurred while the server was waiting for the request.

5xx
means the server was unable to complete an apparently valid request. This type of status code represents that an error or abnormal state occurred when the server was processing the request. Common ones are:
500 Inter Server Error (server internal error): The server encountered an error and was unable to complete the request.
501 (not yet implemented): The server did not Have the function to complete the request. For example, the server may return this code when it does not recognize the request method.
502 (Bad Gateway): The server is acting as a gateway or proxy and received an invalid response from an upstream server.
503 Server Unavailable (Service Unavailable): The server is currently unavailable (due to overload or downtime). Maintenance)
504 Gateway Time-out: The server acted as a gateway or proxy, but the request was not received from the upstream server in time.
505 (HTTP version not supported): The server does not support the HTTP protocol version used in the request.

Five: Applicable scenarios

100: Before sending POST data to the server, the client consults the server to see if the server processes the POST data. If it does not process the POST data, the client will not upload the POST data. If it does, the POST data will be uploaded. Commonly used for POST large data transmission
206: Generally used for resuming breakpoints, or loading large files such as video files
301: Permanent redirection will be cached. The new domain name replaces the old domain name. When the old domain name is no longer in use, users who access the old domain name use 301 to redirect to the new domain name. 302:
Temporary redirection will not be cached and is often used for non-logged-in users to access the user center and redirect to login. Page
304: Negotiate the cache, tell the client that there is a cache, use the data in the cache directly, and return the page with only header information and no content. 400: The parameters are incorrect, and the request cannot be
recognized by the server.
403: Tell the client to prohibit access to the page. For example, when a site or resource is in an external network environment and is accessed only by an intranet IP,
404 will be returned: When the server cannot find the resource, or when the server rejects the request but does not want to explain the reason,
503 will be used: When the server is down for maintenance, use 503 proactively. Respond to the request or set a speed limit on nginx. If the speed limit is exceeded, 503
504: Gateway timeout will be returned.

6. Common status codes
The following are common HTTP status codes:
200 - Request successful
204 - Request processing successful, but no resources can be returned to the client. Generally, only information needs to be sent from the client to the server, and the client Use when there is no need to send new message content.
301 - Resources (web pages, etc.) are permanently transferred to other URLs
302 - Resources (web pages, etc.) are temporarily transferred to other URLs
400 - The server cannot understand the request sent by the client, and there may be syntax errors in the request message.
401- The request requires the user's identity authentication, which generally means that it is not authorized. Please perform relevant authentication, such as login.
404- The requested resource (web page, etc.) does not exist. It is often caused by a code error, a wrong path, an incorrect URL input, or 418 caused by poor network, network congestion, etc.
- The server detects the request header, checks that your operation is suspected of being a crawler, and rejects it, returning 418
500 - Internal server error, unable to complete the request
503 - Sorry, I am busy now. This status code indicates that the server is temporarily overloaded or is being shut down for maintenance and is currently unable to process requests.

Guess you like

Origin blog.csdn.net/m0_49605975/article/details/132859680