Home  >  Article  >  What are the http return status codes?

What are the http return status codes?

百草
百草Original
2023-10-18 15:22:543871browse

http return status codes include 100, 101, 200, 201, 204, 301, 302, 304, 400, 401, 403, 404, 500, 502, 503, etc. Detailed introduction: 1. 100, the server has received the header of the request, and the client should continue to send the remaining part of the request; 2. 101, the server requires switching protocols, such as switching from HTTP protocol to WebSocket protocol; 3. 200, request Processed successfully and the requested data is returned; 4, 401, etc.

What are the http return status codes?

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

HTTP (Hypertext Transfer Protocol) is a protocol used to transfer data between clients and servers. During the HTTP communication process, the server will return a status code to indicate the processing result of the request. This status code consists of three digits, and each status code has a specific meaning. The following are common HTTP return status codes:

1. 1xx (informational status code): Indicates that the received request is being processed.

- 100 (Continue): The server has received the headers of the request, and the client should continue sending the remainder of the request.

- 101 (Switch protocol): The server requires switching protocols, such as switching from HTTP protocol to WebSocket protocol.

2. 2xx (success status code): Indicates that the request has been successfully processed.

- 200 (Success): The request was successfully processed and the requested data was returned.

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

- 204 (No Content): The request was successfully processed, but no content was returned.

3. 3xx (redirect status code): Indicates that further operations are required to complete the request.

- 301 (Permanent Redirect): The requested resource has been permanently moved to a new URL.

- 302 (Temporary Redirect): The requested resource is temporarily moved to a new URL.

- 304 (Unmodified): The client sent a conditional request, and the server returned an unmodified status, indicating that the client's cached copy is still valid.

4. 4xx (client error status code): Indicates that an error occurred on the client.

- 400 (Bad Request): The server cannot understand the request sent by the client.

- 401 (Unauthorized): The request requires user authentication.

- 403 (Forbidden): The server rejected the client's request.

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

5. 5xx (server error status code): Indicates that an error occurred on the server.

- 500 (Server Internal Error): An unknown internal error occurred in the server.

- 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 process requests, usually due to overload or maintenance.

In addition to the above common HTTP status codes, there are some other status codes, such as 206 (partial content), 301 (permanent redirect), 401 (unauthorized), 403 (forbidden), 408 (request timeout) ), 429 (Too Many Requests), etc. Each status code has its specific meaning and purpose.

In web development, understanding HTTP status codes is very important for debugging and troubleshooting problems. By observing the returned status code, we can understand whether the request is successful, whether redirection is required, whether there is permission to access resources, and other information, so that we can take corresponding processing measures based on different status codes.

The above is the detailed content of What are the http return 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