HTTP status code review: from "404 Not Found" to "418 I am a teapot"

2025.04.11
As a modern person who surfs the Internet every day, you must have seen various HTTP status codes - especially the "404 Not Found" that makes people love and hate it. But do you know? HTTP status codes are far more than just 404. They are like the Morse code of the Internet world, silently transmitting secret messages between the server and the browser.

Today, let us unveil these mysterious numbers and understand the stories and meanings behind them. Whether you are an ordinary netizen, a front-end developer or a webmaster, this article will open a door to the internal operating mechanism of the HTTP protocol for you.

1. HTTP status code: the "Morse code" of the Internet
1. What is the HTTP status code?


Simply put, HTTP status codes are the server's response code to a browser request. When you click a link or enter a URL, your browser sends a request to the server, and the server returns a three-digit status code to tell you the result of the request.

2. Classification of status codes
HTTP status codes are divided into 5 categories based on the first digit:

1xx (information status code): the request has been received and continues to be processed

2xx (success status code): the request has been successfully received, understood and accepted by the server

3xx (redirection status code): subsequent operations are required to complete this request

4xx (client error status code): the request contains a lexical error or cannot be executed

5xx (server error status code): the server encountered an error when processing a correct request


2. Analysis of the most common HTTP status codes
1. Success category (2xx) - everything went well
200 OK: This is the most ideal status, indicating that the request has been successful, and the response header or data body expected by the request will be returned with this response.
201 Created: The request has been fulfilled, and a new resource has been created according to the needs of the request.
204 No Content: The server successfully processed the request, but no entity content needs to be returned.
Tips: When you submit a form and see that the page has not changed, it is likely that a 204 status code has been returned.
2. Redirect category (3xx) - please change location
301 Moved Permanently: Permanent redirection. The requested resource has been permanently moved to a new location.
302 Found: Temporary redirection. The requested resource is now temporarily responding to requests from a different URI.
304 Not Modified: The resource has not been modified, and the client can use the cached version directly.
SEO Tips: 301 redirects help transfer page authority, while 302 does not. Be careful to use them differently when redesigning your website.

3. Client Error Class (4xx) - Your Problem

400 Bad Request: The request has a syntax error and the server cannot understand it.

401 Unauthorized: Authentication is required. Similar to "Please log in first".

403 Forbidden: The server understands the request but refuses to execute it. A step further than 401, even if authenticated, there is no access.

404 Not Found: The most famous status code, the requested resource does not exist.

418 I'm a teapot: Easter egg status code! From an April Fool's Day joke in 1998, it means "I'm a teapot" and cannot make coffee.
4. Server Error Category (5xx) - Server Problem
500 Internal Server Error: The server encountered an unexpected situation and could not complete the request.
502 Bad Gateway: When a server working as a gateway or proxy program tried to execute a request, it received an invalid response from the upstream server.
503 Service Unavailable: The server is currently unable to process the request, usually due to temporary overload or maintenance.
504 Gateway Timeout: The gateway timed out, and the server, as a gateway or proxy, did not receive the request from the upstream server in time.
3. Interesting knowledge and practical skills of status codes
1. Those interesting status codes
In addition to the formal status codes, there are some unofficial but interesting status codes on the Internet:
420 Enhance Your Calm: Twitter used this to indicate rate limits (from the movie "Frankenstein")
451 Unavailable For Legal Reasons: Unavailable for legal reasons (tribute to "Fahrenheit 451")
509 Bandwidth Limit Exceeded: Bandwidth limit exceeded

2. Developer debugging tips
Chrome developer tools: The Network tab allows you to view the status code of each request
curl command: curl -I URL can only obtain HTTP header information
Online tools: Websites like httpstatus.io can help detect the status code of the entire site
3. SEO optimization tips
Make sure important pages return a 200 status code
Deleted pages should return 410 (Gone) instead of 404
Use 503 instead of 404 for temporary maintenance
Redirection chain should not be too long (preferably no more than 3 times)
IV. Status code and user experience
Understanding HTTP status code can not only help developers to debug problems, but also improve user experience:

Custom error page: turn the cold 404 page into a friendly guide page
Smart redirection: when the page moves, automatically guide the user to the correct location
Error warning: monitoring 500 errors can detect server problems in advance
5. Conclusion
As a general user, understanding these status codes can help you better understand what happens when a web page is loaded; as a website operator, making proper use of status codes can improve SEO results and user experience; as a developer, being proficient in status codes is an important skill for debugging and optimization.