The HTTP status code is a 3-bit numeric code that represents the HTTP response status of the Web server. It is defined by the RFC 2616 specification and is extended by RFC 2518, RFC 2817, RFC 2295, RFC 2774, RFC 4918, and other specifications.
The first number of all status codes represents one of the five states of the response.
100 Series Code
The HTTP status code from 100 to 199 is the information report code. For a variety of reasons, we rarely see these codes in most cases. First, if a browser tries to access a Web site, and the site returns the code, they tend not to appear on the screen. They are just browsers that make reference to the internal code. Another reason why these codes are not common is that the initial HTTP standard does not allow the use of this range of status codes. For their part, they have not been widely used.
200 Series Code
The status code from 200 to 299 is the operation success code. Similarly, in normal web surfing, you probably never see the code on the screen. Instead, the code is used inside the browser to confirm the success of the operation and the status of the current request. Although these codes are usually not displayed, some troubleshooting tools can read them, as with most HTTP status codes, which are useful in the error diagnosis process.
300 series Code
A status code ranging from 300 to 399 is a redirect code. Essentially, they tell the Web browser that some other action must be taken to complete the request. Based on the characteristics of this command, it can be executed automatically, or require additional user input. For example, a status code of 301 indicates that a particular resource has been permanently removed, so all access to that resource request should be directed to a specific URL in the future.
400 series Code
The status code in the 400 range is the client error code. This type of error code is often associated with security. For example, if a client tries to access a resource that is not authorized to access it, the server returns a status code of 401. Similarly, if a client attempts to access a prohibited resource, in which case the client's authentication status is the same, the server may return a status code of 403, which means that the resource is forbidden to access.
A level 400 error code may also be returned if the request is incorrect or the client times out. However, there is a level 400 code that is always misleading: 404. Although this code is technically classified as a client-side error, it can actually represent errors on the client or server at the same time. However, this error code simply shows that the requested resource was not found. When this error occurs on the client, it often indicates a network connectivity problem. At other times, this error can also occur because the resource has been transferred or renamed from the server.
500 Series Code
A level 500 status code indicates a server error. For example, if the Web server times out, it generates a 504 error. Although, a 500-level error often represents a problem for a Web application that is not a server problem, but is running on the server. For example, my own personal website is written in ASP, which is responsible for dynamically generating HTML pages. During debugging, the bug code always causes my web server to return an HTTP status code of 500, which is a general indication of an internal server error. This code only has a problem, and HTTP cannot resolve the problem.
1xx– Information Tips
- "100″:continue
- "101″:witchingprotocols
2xx– success
- "200″:ok
- "201″:created
- "202″:accepted
- "203″:non-authoritativeinformation
- "204″:nocontent
- "205″:resetcontent
- "206″:P artialcontent
3xx– redirection
- "300″:multiplechoices
- "301″:movedpermanently
- "302″:found
- "303″:seeother
- "304″:notmodified
- "305″:useproxy
- "307″:temporaryredirect
4xx– Client Error
- "400″:badrequest
- "401″:unauthorized
- "402″:P aymentrequired
- "403″:forbidden
- "404″:notfound
- "405″:methodnotallowed
- "406″:notacceptable
- "407″:P roxyauthenticationrequired
- "408″:requesttime-out
- "409″:conflict
- "410″:gone
- "411″:lengthrequired
- "412″:P reconditionfailed
- "413″:requestentitytoolarge
- "414″:request-uritoolarge
- "415″:unsupportedmediatype
- "416″:requestedrangenotsatisfiable
- "417″:expectationfailed
5xx– Server Error
- "500″:internalservererror
- "501″:notimplemented
- "502″:badgateway
- "503″:serviceunavailable
- "504″:gatewaytime-out
- "505″:httpversionnotsupported
Status code |
Status information |
Meaning |
100 |
Continue |
The initial request has been accepted and the customer should continue to send the remainder of the request. (HTTP 1.1 new) |
101 |
Switching protocols |
The server translates the client's request to another protocol (HTTP 1.1 new) |
200 |
Ok |
Everything is OK, the answer document for Get and post requests is followed. |
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 been completed. |
203 |
Non-authoritative Information |
The document has returned normally, but some of the answer headers may be incorrect because a copy of the document is being used (HTTP 1.1 is new). |
204 |
No Content |
Without a new document, the browser should continue to display the original document. This status code is useful if the user refreshes the page on a regular basis and the servlet can determine that the user's document is new enough. |
205 |
Reset Content |
There is no new content, but the browser should reset what it displays. Used to force the browser to clear the form input (HTTP 1.1 new). |
206 |
Partial Content |
The client sends a GET request with a range header, and the server finishes it (HTTP 1.1 is new). |
300 |
Multiple Choices |
The documents requested by the customer can be found in multiple locations that are listed in the returned document. If the server wants to make a preference, it should be indicated in the location answer header. |
301 |
Moved Permanently |
The document requested by the customer elsewhere, the new URL is given in the location header, and the browser should automatically access the new URL. |
60W |
Found |
Similar to 301, but the new URL should be treated as a temporary replacement instead of permanent. Note that the corresponding status information in HTTP1.0 is "Moved temporatily". When the status code appears, the browser can automatically access the new URL, so it is a useful status code. Note that this status code can sometimes be used with 301 substitutions. For example, if the browser mistakenly requests HTTP://host/~user (the trailing slash is missing), some servers return 301, and some return 302. Strictly speaking, we can only assume that the browser will automatically redirect only if the original request is get. See 307. |
303 |
See other |
Similar to 301/302, the difference is that if the original request is the Post,location header the specified redirect target document should be fetched via get (HTTP 1.1 new). |
304 |
Not Modified |
The client has a buffered document and issues a conditional request (typically providing a if-modified-since header indicating that the customer only wants to update the document than the specified date). The server tells the customer that the original buffered document can continue to be used. |
305 |
Use Proxy |
The document requested by the client should be extracted from the proxy server indicated by the location header (HTTP 1.1 is new). |
307 |
Temporary Redirect |
Same as 302 (Found). Many browsers incorrectly respond to a 302 response for redirection, even if the original request is post, even though it can actually be redirected only if the answer to the POST request is 303. For this reason, HTTP 1.1 has been added in 307 to allow for more cleanup of the region in several status codes: When a 303 response occurs, the browser can follow the redirected get and post requests, and if the 307 answer, the browser can only follow the redirect to the GET request. (HTTP 1.1 new) |
400 |
Bad Request |
A syntax error occurred in the request. |
401 |
Unauthorized |
The customer attempted to access a password-protected page without authorization. A www-authenticate header is included in the answer, and the browser displays the user name/Password dialog box, and then makes a request again after filling in the appropriate authorization header. |
403 |
Forbidden |
The resource is not available. The server understands the customer's request, but refuses to process it. This is usually caused by the permissions set on the file or directory on the server. |
404 |
Not Found |
The resource at the specified location could not be found. This is also a common answer. |
405 |
Method not allowed |
The request method (GET, POST, HEAD, DELETE, PUT, Trace, and so on) does not apply to the specified resource. (HTTP 1.1 new) |
50W |
Not acceptable |
The specified resource has been found, but its MIME type is incompatible with the client specified in the Accpet header (HTTP 1.1 new). |
407 |
Proxy Authentication Required |
Similar to 401, indicates that the customer must be authorized by the proxy server first. (HTTP 1.1 new) |
408 |
Request Timeout |
The customer has not made any requests during the waiting time for the server license. Customers can repeat the same request at a later time. (HTTP 1.1 new) |
409 |
Conflict |
Usually related to put requests. The request cannot succeed because the request conflicts with the current state of the resource. (HTTP 1.1 new) |
410 |
Gone |
The requested document is no longer available, and the server does not know which address to redirect to. It differs from 404 in that returning 407 means that the document has permanently left the specified location, and 404 indicates that the document is unavailable for unknown reasons. (HTTP 1.1 new) |
411 |
Length Required |
The server cannot process the request unless the customer sends a content-length header. (HTTP 1.1 new) |
412 |
Precondition Failed |
Some of the prerequisites specified in the request header failed (HTTP 1.1 new). |
413 |
Request Entity Too Large |
The size of the destination document exceeds the size that the server is currently willing to handle. If the server thinks it can process the request later, it should provide a Retry-after header (HTTP 1.1 new). |
414 |
Request URI Too Long |
The URI is too long (HTTP 1.1 new). |
416 |
Requested Range not satisfiable |
The server does not meet the range header specified by the customer in the request. (HTTP 1.1 new) |
500 |
Internal Server Error |
The server encountered an unexpected situation and could not complete the customer's request. |
501 |
Not implemented |
The server does not support the functionality required to implement the request. For example, a customer sends a put request that is not supported by the server. |
40S |
Bad Gateway |
When the server acts as a gateway or proxy, the server returns an illegal response in order to complete the request to access the next server. |
503 |
Service unavailable |
The server failed to answer due to maintenance or heavy load. For example, a servlet might return 503 if the database connection pool is full. A retry-after header can be supplied when the server returns 503. |
504 |
Gateway Timeout |
Used by a server acting as a proxy or gateway, indicating that an answer cannot be received from a remote server in a timely manner. (HTTP 1.1 new) |
505 |
HTTP Version not supported |
The HTTP version indicated in the request is not supported by the server. (HTTP 1.1 new) |
Introduction of various HTTP status codes returned by the server (GO)