preface

For the learning of HTTP status code, I would like to sort out the following four aspects:

  • What is an HTTP status code
  • Tool for querying HTTP status codes
  • What can HTTP status codes do
  • Common HTTP status codes and their meanings

What is an HTTP status code

I’d like to take a look at HTTP’s composition so that we can see what role HTTP status codes play.

HTTP:

  • The HTTP request:
  1. Request method and URL and practical protocol
  2. Request header
  3. Request body
  • The HTTP response
  1. Protocol and status code
  2. Response headers
  3. In response to the body

Thus, when a visitor visits a web page, the visitor’s browser makes a request to the server where the page is located. When the browser receives and displays a web page, the server on which the web page is located returns a header containing an HTTP status code in response to the browser’s request. The HTTP status code generally consists of three decimal digits.

Tool for querying HTTP status codes

Please click HTTP status code query

What can HTTP status codes do

At its core, the HTTP status code is used by the server to tell the client what happened to the current web request. As a developer, you need to know as much about these status codes as possible. In order to meet the development process can be targeted to solve the problem.

Common HTTP status codes

Type of generalization

  • 1** The server has received the request and needs the requester to continue
  • 2** The request is successful, and the operation is received and processed successfully
  • 3** Request redirection, further action is required to complete the request
  • 4** Client error
  • 5** Server error

The HTTP status code

100 The client continues to send the request, which is the status code of the temporary response.

101 The server switches protocols based on client requests. (Can only switch to a more advanced protocol)

102 processing will continue

200 The server has successfully processed the request

201 The request succeeds and the server creates a new resource.

202 The server has accepted the request but has not yet processed it.

203 The server has successfully processed the request but the information returned may come from another source.

204 The server successfully processed the request but did not return anything.

205 The server successfully processed the request and the client should reset the document view. Use this return code to clear the browser’s form field.

206 The server successfully processed some GET requests.

207 indicates that the subsequent message will be an XML message.

300 Multiple operations can be performed on the server. The server can select an operation based on the requester, or it can provide a list of operations for the requester to select.

301 permanent move. The requested resource has been permanently moved to the new URL. Any future new requests will use the new URL.

302 Temporary move. The server currently responds to requests from web pages in different locations, but the requester should continue to use the original location for future requests.

303 (View other locations) The server returns this code when the requester should use a separate GET request for a different location to retrieve the response.

304 (Unmodified) The requested page has not been modified since the last request. When the server returns this response, the web page content is not returned.

305 (Using a proxy) The requester can only access the requested web page using a proxy. If the server returns this response, it also indicates that the requester should use a proxy.

307 (temporary redirection) The server currently responds to requests from web pages in different locations, but the requester should continue to use the original location for future requests.

400 (Error request) Server does not understand the syntax of the request.

The 401 (unauthorized) request requires authentication. The server may return this response for a web page that requires login.

403 (Forbidden) The server rejects the request.

404 (Not found) The server could not find the requested page.

405 (method disable) Disables the method specified in the request.

406 (Not accepted) Web pages that cannot respond to a request using the requested content feature.

407 (Proxy authorization required) This status code is similar to 401 (unauthorized), but specifies that the requester should authorize the use of the proxy.

408 (Request Timeout) The server timed out while waiting for a request.

409 (Conflict) A server conflict while completing a request. The server must include information about the conflict in the response.

410 (Deleted) The server returns this response if the requested resource has been permanently deleted.

411 (Valid length required) The server will not accept requests that do not contain a valid content length header field.

412 (Conditions not met) The server does not meet one of the conditions set by the requester in the request.

413 (Request entity too large) The server cannot process the request because the request entity is too large for the server to handle.

414 (Request URI too long) The request URI (usually the url) is too long for the server to process.

415 (Unsupported media Type) The requested format is not supported by the requested page.

416 (Requested scope not required) If the page cannot provide the requested scope, the server returns this status code.

417 (Unmet expected value) The server did not meet the requirements for the “expected” request header field.

These status codes indicate that an internal error occurred while the server was trying to process the request.

These errors may be server errors rather than request errors.

500 (Server internal error) The server encountered an error and could not complete the request.

The 501 (not yet implemented) server does not have the capability to complete requests. For example, the server may return this code if it does not recognize the request method.

502 (Error Gateway) server, acting as gateway or proxy, received invalid response from upstream server.

503 (Service unavailable) The server is currently unavailable (due to overloading or downtime for maintenance). Usually, this is a temporary state.

504 (Gateway Timeout) The server acted as a gateway or proxy, but did not receive the request from the upstream server in time.

505 (HTTP version not supported) The server does not support the HTTP protocol version used in the request.