Introduction to various HTTP status codes returned by the server

Source: Internet
Author: User
Tags http status code 500 rfc

HTTP status code is a three-digit code used to indicate the HTTP response status of a Web server. It is defined by the RFC 2616 specification and has been extended by specifications such as RFC 2518, RFC 2817, RFC 2295, and RFC 2774.

The first number of all status codes represents one of the five response states.

100 series Codes

The HTTP status code from 100 to 199 is an information report code. For various reasons, we rarely see the code in most cases. First, if a browser tries to access a website and the website returns the code, the code is usually not displayed on the screen. They are only the internal code referenced by the browser. In addition, this code is not common because the HTTP standard does not allow this range of status codes at first. In itself, they have never been widely used.

200 series Codes

The status code from 200 to 299 is the code for successful operations. Similarly, in normal Web surfing, you may not see the code on the screen. On the contrary, the code is used inside the browser to confirm the operation is successful and the current request status. Although these codes are usually not displayed, some troubleshooting tools can read them, just like most other HTTP status codes, which are very useful in the error diagnosis process.

300 series Codes

The status code from 300 to 399 is the redirection code. Essentially, they tell Web browsers that they must perform other operations to complete the request. Based on the features of this command, it can be automatically executed or requires additional user input. For example, status code 301 indicates that a specific resource has been permanently removed first, because in the future, all requests to access this resource should be directed to a specific URL.

400 series Codes

The status code in the range of 400 is the client error code. This type of error code is often related to security. For example, if a client attempts to access an unauthorized resource, the server returns a Status Code 401. Similarly, if the client tries to access a prohibited resource and the authentication status of the client is the same in this case, the server may return a status code 403, indicates that access to this resource is prohibited.

If the request is incorrect or the client exceeds the upper limit, the error code of level 400 may also be returned. However, there is a 400 level code that is always misleading: 404. Although this code is technically classified as a client error, it can display errors on the client or server at the same time. However, this error code is simply displayed as the requested resource is not found. When this error occurs on the client, it usually indicates a network connection problem. In other cases, this error may also occur because the resource has been transferred or renamed from the server.

500 series Codes

Status Code 500 indicates a server error. For example, if the web server times out, it will generate a 504 error. Although a 500-level error often indicates a web application running on the server rather than a server issue. For example, my personal website is written in ASP and is responsible for dynamically generating HTML webpages. During debugging, code with bugs always causes my web server to return HTTP status code 500, which generally indicates an internal server error. This code is just a problem, and HTTP cannot solve the problem.

1xx-Information prompt

  • "100": continue
  • 101 ": witchingprotocols

2XX-success

  • "200": OK
  • 201 ": created
  • "202": accepted
  • "203": Non-authoritativeinformation
  • 204 ": nocontent
  • "205": resetcontent
  • "206": partialcontent

3xx-redirection

  • "300": multiplechoices
  • "301": movedpermanently
  • 302 ": Found
  • 303 ": seeother
  • "304": notmodified
  • "305": useproxy
  • "307": temporaryredirect

4xx-client Error

  • "400": badrequest
  • "401": unauthorized
  • "402": paymentrequired
  • 403 ": forbidden
  • 404 ": notfound
  • "405": methodnotallowed
  • 406 ": notacceptable
  • "407": proxyauthenticationrequired
  • 408 ": requesttime-out
  • "409": Conflict
  • 410 ": Gone
  • 411 ": lengthrequired
  • "412": preconditionfailed
  • "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 Description
100 Continue The initial request has been accepted, and the customer should continue to send the rest of the request. (New HTTP 1.1)
101 Switching protocols The server converts a client-compliant request to another protocol (New in HTTP 1.1)
200 OK Everything works normally. The response documents for get and post requests follow.
201 Created The server has created a document and the location header provides its URL.
202 Accepted The request has been accepted, but the processing has not been completed.
203 Non-authoritative information The document has been returned normally, but some response headers may be incorrect because the document is copied (New in HTTP 1.1 ).
204 NO content If no new document exists, the browser should continue to display the original document. This status code is useful if the user regularly refreshes the page and the servlet can determine that the user document is new enough.
205 Reset content There is no new content, but the browser should reset the content it shows. Used to force the browser to clear the input content of the form (New in HTTP 1.1 ).
206 Partial content The client sends a GET request with a range header, and the server completes the request (New in HTTP 1.1 ).
300 Multiple Choices Documents requested by the customer can be found in multiple locations, which are listed in the returned documents. If the server needs to give priority, it should be specified in the location response header.
301 Moved permanently The document requested by the customer is elsewhere. The new URL is provided in the location header, and the browser should automatically access the new URL.
302 Found Class is similar to 301, but the new URL should be treated as a temporary alternative, rather than permanent. Note that the corresponding status information in http1.0 is "Moved temporatily ". When this status code appears, the browser can automatically access the new URL, so it is a very useful status code. Note that this status code can be replaced with 301 sometimes. For example, if the browser mistakenly requests http: // host /~ If the user (with a slash missing), some servers return 301, and some return 302.

Strictly speaking, we can only assume that the browser will automatically redirect only when the original request is get. See 307.

303 See other Similar to 301/302, the difference is that if the original request is post, the redirection target document specified by the location header should be extracted through get (New in HTTP 1.1 ).
304 Not modified The client has a buffered document and sends a conditional request (generally, the IF-modified-since header is provided to indicate that the customer only wants to update the document on a specified date ). The server sued the customer for continuing to use the previously buffered documents.
305 Use proxy The document requested by the customer should be extracted by the proxy server specified by the location header (New in HTTP 1.1 ).
307 Temporary redirect It is the same as 302 (found. Many browsers mistakenly respond to the 302 response for redirection. Even if the original request is post, the redirection can only be reset when the response of the POST request is 303. For this reason, HTTP 1.1 adds 307 to clear the region code in several states: When a 303 response occurs, the browser can follow the redirected get and post requests; if a 307 response occurs, the browser can only follow the redirection to get requests. (New HTTP 1.1)
400 Bad request The request has a syntax error.
401 Unauthorized The customer attempted to access the password-protected page without authorization. The response contains a WWW-Authenticate header. the browser displays the username/password dialog box accordingly, and then sends a request again after entering the appropriate authorization header.
403 Forbidden Resource unavailable. The server understands the customer's request, but rejects the request. This is usually caused by permission settings for files or directories on the server.
404 Not found The resource at the specified location cannot be found. This is also a common response.
405 Method not allowed Request methods (get, post, Head, delete, put, Trace, etc.) are not applicable to specified resources. (New HTTP 1.1)
406 Not acceptable The specified resource has been found, but its MIME type is incompatible with the one specified by the customer in the accpet header (New in HTTP 1.1 ).
407 Proxy authentication required Similar to 401, the customer must first be authorized by the proxy server. (New HTTP 1.1)
408 Request timeout The customer has not issued any request within the waiting time of the server license. The customer can repeat the same request later. (New HTTP 1.1)
409 Conflict It is usually related to put requests. The request cannot be successful because the request conflicts with the current status of the resource. (New HTTP 1.1)
410 Gone The requested document is no longer available and the server does not know which address to redirect. It differs from 404 in that if 407 is returned, the document permanently leaves the specified position, and 404 indicates that the document is unavailable for unknown reasons. (New HTTP 1.1)
411 Length required The server cannot process the request unless the client sends a Content-Length header. (New HTTP 1.1)
412 Precondition failed Some preconditions specified in the request header fail (HTTP 1.1 is new ).
413 Request Entity too large The size of the target document exceeds the size that the server is willing to process. If the server thinks it can process the request later, it should provide a retry-after header (New in HTTP 1.1 ).
414 Request URI Too Long The URI is too long (New in HTTP 1.1 ).
416 Requested range not satisfiable The server cannot meet the range header specified by the customer in the request. (New HTTP 1.1)
500 Internal Server Error The server encounters unexpected circumstances and cannot complete the customer's request.
501 Not Implemented The server does not support the functions required to implement the request. For example, the customer sends a put request not supported by the server.
502 Bad Gateway When the server acts as a gateway or proxy, in order to complete the request to access the next server, but the server returns an invalid response.
503 Service unavailable The server fails to respond due to maintenance or heavy load. For example, Servlet may return 503 when the database connection pool is full. When the server returns 503, A retry-after header can be provided.
504 Gateway timeout Used by a proxy or gateway server, it indicates that the remote server cannot receive a response in a timely manner. (New HTTP 1.1)
505 HTTP Version Not Supported The server does not support the HTTP Version specified in the request. (New HTTP 1.1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.