Home >Web Front-end >JS Tutorial >HTTP status codes and definitions (explanations)_Basic knowledge
Recently, I often worry about the status of Ajax requests or the status of server-side cross-domain requests. Now save the following article.
When we usually browse the web, we will also find that some files are displayed as "404 errors" when they do not exist. This is the common Http request status (status)
The web server responds to the browser or When requested by other client programs, the response generally consists of the following parts: a status line, several response headers, a blank line, and a content document. The following is the simplest response:
The status line contains the HTTP version, status code, and a brief description corresponding to the status code. In most cases, all response headers except Content-Type are optional. But Content-Type is required, it describes the MIME type of the subsequent document. While most responses include a document, some do not; for example, responses to HEAD requests never come with a document. There are many status codes that actually identify a failed request, and these responses also contain no documentation (or only a brief error message).
When a user attempts to access content on a server running Internet Information Services (IIS) via HTTP, IIS returns a numeric code indicating the status of the request. Status codes can indicate whether a specific request was successful and can also reveal the exact reason why the request failed.
1xx - Information prompt
These status codes indicate temporary responses. The client should be prepared to receive one or more 1xx responses before receiving a regular response.
· 100 - Continue The initial request has been accepted and the client should continue sending the remainder of the request. (New in HTTP 1.1)
· 101 - Switching Protocols The server will comply with the client's request and convert to another protocol (New in HTTP 1.1)
2xx - Successful
This type of status code indicates The server successfully accepted the client request.
· 200 - OK Everything is fine, and the response documents for GET and POST requests follow.
· 201 - Created The server has created the document, and the Location header gives its URL.
· 202 - Accepted The request has been accepted, but the processing has not yet been completed.
· 203 - Non-Authoritative Information The document has been returned normally, but some response headers may be incorrect because a copy of the document is used, non-authoritative information (new in HTTP 1.1).
· 204 - No Content There is no new document, the browser should continue to display the original document. This status code is useful if the user refreshes the page regularly and the servlet can determine that the user's document is current enough.
· 205 - Reset Content No new content, but the browser should reset the content it displays. Used to force the browser to clear form input content (new in HTTP 1.1).
· 206 - Partial Content The client sent a GET request with a Range header and the server completed it (new in HTTP 1.1).
3xx - Redirect
The client browser must take additional actions to fulfill the request. For example, the browser may have to request a different page on the server, or repeat the request through a proxy server.
· 300 - Multiple Choices The document requested by the client can be found in multiple locations, and these locations are listed in the returned document. If the server wants to propose a preference, it should indicate it in the Location response header.
· 301 - Moved Permanently The document requested by the client is elsewhere. The new URL is given in the Location header, and the browser should automatically access the new URL.
· 302 - Found Similar to 301, but the new URL should be considered a temporary replacement rather than a permanent one. Note that the corresponding status information in HTTP 1.0 is "Moved Temporatily".When this status code occurs, the browser can automatically access the new URL, so it is a useful status code. Note that this status code can sometimes be used interchangeably with 301. For example, if the browser incorrectly requests http://host/~user (missing the trailing slash), some servers will return 301 and some will return 302. Strictly speaking, we can only assume that the browser will automatically redirect only if the original request was a GET. See 307.
· 303 - See Other Similar to 301/302, except that if the original request was POST, the redirect target document specified by the Location header should be fetched via GET (new in HTTP 1.1).
· 304 - Not Modified The client has a buffered document and issued a conditional request (usually providing an If-Modified-Since header to indicate that the client only wants documents that are newer than the specified date). The server tells the client that the original buffered document can continue to be used.
· 305 - Use Proxy The document requested by the client should be retrieved through the proxy server specified by the Location header (new in HTTP 1.1).
· 307 - Temporary Redirect is the same as 302 (Found). Many browsers will incorrectly redirect with a 302 response, even if the original request was a POST, even though it can actually only redirect if the response to a POST request is a 303. For this reason, HTTP 1.1 added 307 to more clearly distinguish between several status codes: when a 303 response occurs, the browser can follow redirected GET and POST requests; if it is a 307 response, the browser can only follow Redirection of GET requests. (New in HTTP 1.1)
4xx - Client Error
An error occurred and there seems to be a problem with the client. For example, the client requests a page that does not exist, and the client does not provide valid authentication information.
· 400 - Bad Request A syntax error occurred in the request.
· 401 - Unauthorized Access is denied. The customer attempted to access a password-protected page without authorization. The response will contain a WWW-Authenticate header, and the browser will display the username/password dialog box accordingly, and then make the request again after filling in the appropriate Authorization header. IIS defines many different 401 errors, which indicate more specific causes of errors. These specific error codes show up in the browser, but not in the IIS logs:
· 401.1 - Login failed.
· 401.2 - Server configuration caused login failure.
· 401.3 - Not authorized due to ACL restrictions on resources.
· 401.4 - Filter authorization failed.
· 401.5 - ISAPI/CGI application authorization failed.
· 401.7 – Access is denied by the URL authorization policy on the web server. This error code is specific to IIS 6.0.
· 403 - Forbidden The resource is not available. The server understands the client's request but refuses to process it. Usually caused by the permission settings of files or directories on the server. Forbidden: IIS defines a number of different 403 errors, which indicate more specific error causes:
· 403.1 - Execution access is forbidden.
· 403.2 - Read access prohibited.
· 403.3 - Write access prohibited.
· 403.4 - Requires SSL.
· 403.5 - Requires SSL 128.
· 403.6 - IP address rejected.
· 403.7 - Client certificate required.
· 403.8 - Site access denied.
· 403.9 - Too many users.
· 403.10 - Invalid configuration.
· 403.11 - Password change.
· 403.12 - Access to mapping table denied.
· 403.13 - Client certificate revoked.
· 403.14 - Deny directory listing.
· 403.15 - Client access permission exceeded.
· 403.16 - Client certificate is not trusted or invalid.
· 403.17 - The client certificate has expired or is not yet valid.
· 403.18 - The requested URL cannot be executed in the current application pool. This error code is specific to IIS 6.0.
· 403.19 - Cannot perform CGI for clients in this application pool. This error code is specific to IIS 6.0.
· 403.20 - Passport login failed. This error code is specific to IIS 6.0.
· 404 - Not Found The resource at the specified location cannot be found. This is also a common response.
· 404.0 - (None) – File or directory not found.
· 404.1 - The web site cannot be accessed on the requested port.
· 404.2 - This request is blocked by the Web Services extension locking policy.
· 404.3 - MIME mapping policy blocks this request.
· 405 - Method Not Allowed The request method (GET, POST, HEAD, Delete, PUT, TRACE, etc.) is not applicable to the specified resource, and the HTTP verb used to access this page is not allowed (the method is not Allow) (New in HTTP 1.1)
· 406 - Not Acceptable The specified resource has been found, but its MIME type is incompatible with the one specified by the client in the Accpet header. The client browser does not accept the MIME type of the requested page. (New in HTTP 1.1).
· 407 - Proxy Authentication Required requires proxy authentication, similar to 401, indicating that the client must first be authorized by the proxy server. (New in HTTP 1.1)
· 408 - Request Timeout The client has not issued any request during the waiting time allowed by the server. The client can repeat the same request later. (New in HTTP 1.1)
· 409 - Conflict Usually related to PUT requests. The request cannot succeed because it conflicts with the current state of the resource. (New in HTTP 1.1)
· 410 - Gone The requested document is no longer available, and the server does not know which address to redirect to. The difference between it and 404 is that returning 407 means that the document has permanently left the specified location, while 404 means that the document is unavailable for unknown reasons. (New in HTTP 1.1)
· 411 - Length Required The server cannot process the request unless the client sends a Content-Length header. (New in HTTP 1.1)
· 412 - Precondition Failed Some preconditions specified in the request header failed (New in HTTP 1.1).
· 413 – Request Entity Too Large The size of the target document exceeds the size that the server is currently willing to handle. If the server thinks it can handle the request later, it should provide a Retry-After header (new in HTTP 1.1).
· 414 - Request URI Too Long URI is too long (new in HTTP 1.1).
· 415 – Unsupported media type.
· 416 – Requested Range Not Satisfiable The server cannot satisfy the Range header specified by the client in the request. (New in HTTP 1.1)
· 417 – Execution failed.
· 423 – Locking error.
5xx - Server Error
The server was unable to complete the request because it encountered an error.
· 500 - Internal Server Error The server encountered an unexpected situation and was unable to complete the client's request.
· 500.12 - The application is busy restarting on the web server.
· 500.13 - The web server is too busy.
· 500.15 - Direct requests to Global.asa are not allowed.
· 500.16 – UNC authorization credentials are incorrect. This error code is specific to IIS 6.0.
· 500.18 – The URL authorization store cannot be opened. This error code is specific to IIS 6.0.
· 500.100 - Internal ASP error.
· 501 - Not Implemented The server does not support the functionality required to implement the request, and the header value specifies an unimplemented configuration. For example, the client makes a PUT request that the server does not support.
· 502 - Bad Gateway When the server acts as a gateway or proxy, it accesses the next server to complete the request, but the server returns an illegal response. It is also said that the web server received an invalid response when acting as a gateway or proxy server.
· 502.1 - CGI application timed out.
· 502.2 - CGI application error.
· 503 - Service Unavailable The service is unavailable. The server failed to respond due to maintenance or overload. For example, a Servlet may return 503 when the database connection pool is full. The server can provide a Retry-After header when returning 503. This error code is specific to IIS 6.0.
· 504 - Gateway Timeout Gateway timeout, used by servers acting as proxies or gateways, indicates that a response cannot be obtained from the remote server in a timely manner. (New in HTTP 1.1).
· 505 - HTTP Version Not Supported The server does not support the HTTP version specified in the request. (New in HTTP 1.1).