Home  >  Article  >  What are the http status codes?

What are the http status codes?

百草
百草Original
2023-10-12 16:41:001098browse

http status codes are 100, 101, 200, 201, 204, 301, 302, 304, 400, 401, 404, 500, 502 and 503, etc. Detailed introduction: 1. 100 Continue, the server has received the request header, and the client should continue to send the main part of the request; 2. 101 Switching Protocols, the server has understood the client's request and will notify the client through the Upgrade message header. End switching protocol and so on.

What are the http status codes?

The operating system for this tutorial: Windows 10 system, DELL G3 computer.

HTTP status code is a response status identifier returned by the server to the client. It is used to indicate the server's processing result of the client's request. There are five categories of HTTP status codes, and each category has some specific status codes. The following are common HTTP status codes and their meanings:

1xx Informational status code (Informational)

This type of status code indicates that the request has been received, is being processed, or requires further action. Common informational status codes are:

- 100 Continue: The server has received the request headers and the client should continue sending the body of the request.

- 101 Switching Protocols: The server has understood the client's request and will notify the client of switching protocols through the Upgrade message header.

2xx Successful status code (Successful)

This type of status code indicates that the request has been successfully received, understood and processed by the server. Common success status codes are:

- 200 OK: The request is successful and the server returns the requested content normally.

- 201 Created: The request was successful and the server created a new resource.

- 204 No Content: The request was successful, but the server did not return any content.

3xx Redirection status code (Redirection)

This type of status code indicates that the client needs to take further actions to complete the request. Common redirect status codes are:

- 301 Moved Permanently: The requested resource has been permanently moved to a new URL.

- 302 Found: The requested resource has been temporarily moved to a new URL.

- 304 Not Modified: The client can use the cached version without re-requesting.

4xx Client Error Status Code (Client Error)

This type of status code indicates that there is an error in the request sent by the client. Common client error status codes are:

- 400 Bad Request: The request is invalid and the server cannot understand it.

- 401 Unauthorized: The request requires authentication.

- 404 Not Found: The requested resource does not exist.

5xx Server Error Status Code (Server Error)

This type of status code indicates that an error occurred when the server processed the request. Common server error status codes are:

- 500 Internal Server Error: The server has encountered a situation that it does not know how to handle.

- 502 Bad Gateway: The server, acting as a gateway or proxy, received an invalid response from the upstream server.

- 503 Service Unavailable: The server is temporarily unable to handle the request, usually due to overload or maintenance.

Summary:

HTTP status code is an identifier used to indicate the result of the server's processing of the client's request. According to the different status codes, you can determine whether the request is successful, whether redirection is required, whether there are client errors or server errors, etc. Understanding HTTP status codes helps developers better debug and handle network requests and improve user experience.

The above is the detailed content of What are the http status codes?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn