418 I’m a Teapot

  • codedamn official's profile image
    codedamn official
418 I’m a Teapot

There is a status code in HTTP, 418, which is “I’m a teapot.”

What are HTTP status codes anyway?

As most of you may know, HTTP is an application-layer protocol for transferring hypermedia documents throughout the web. HTTP status codes are set of numbers that are not continuous, which tells us about the response status for an HTTP request made. These responses are grouped into five classes for easy categorization.

1xx Informational Codes

So these codes start with one and come with any other two digits (for example, 100). Most of the codes are not important as a developer. The only code that makes sense for you to know would be 101, which is returned when an HTTP connection is upgraded to Web Socket Connections. More about web sockets.

2xx Success Codes

200 – OK

The most important and must know code is 200 which stands for ok. That means everything went well, the request was successfully processed, and the response was returned.

204 – No content returned from the server

This code means that there is no return data from the server to the client. This code is mostly found for caching updates. When there is no more data to cache, you will probably get 204.

206 – Partial Content

This code is mostly returned while streaming videos on the internet. If a requested video is large, you probably don’t want the entire video in a single request as the data would be immense, and it won’t be easy to handle that much data.

3xx Redirection Codes

301 – Moved Permanently

Indicates that the resource requested has been definitively moved to the URL given by the Location headers.

302 – Found

indicates that the resource requested has been temporarily moved to the URL given by the Location header. A browser redirects to this page, but search engines don’t update their links to the resource.

4xx Client Errors

400 Bad Request

Indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). This means that the client should not repeat the request without modification.

401 Unauthorized

Indicates that the request has not been applied because it lacks valid authentication credentials for the target resource. This status is sent with a WWW-Authenticate header that contains information on how to authorize correctly.

403 Forbidden Error

Indicates that the server understood the request but refuses to authorize it. This status is similar to 401, but in this case, re-authenticating will make no difference. The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.

404 Page Not Found

Indicates that the server can’t find the requested resource. Links that lead to a 404 page are often called broken or dead links.

5xx Server Error Codes

When an HTTP code starts with 5 that means the server messed up something, it may have crashed or unable to process your request, or it could be any other reason.

500 Internal Server Error

This error indicates that the server has encountered an unexpected condition. This often occurs when an application request cannot be fulfilled because the application is misconfigured on the server.

502 Bad Gateway

This error is usually due to improperly configured proxy servers. However, the problem may also arise when there is poor IP communication between back-end computers, when the client’s server is overloaded, or when a firewall is functioning improperly.

503 Service Unavailable

This error occurs when the server is unable to handle requests due to a temporary overload or due to the server being temporarily closed for maintenance. The error indicates that the server will only temporarily be down.

418 I’m a teapot

So by now, you might have understood that 418 error is a client error. Technically, the 418 status code is not part of the HTTP Status Codes specification. This was implemented as a joke. In April 1998, the IETF (Internet Engineering Task Force), which handles the Internet standards, proposed this 418 status code as a joke to have a status code 418 that say’s “I am teapot, I can’t brew coffee”. Google has a dedicated page to show this status code. You can also check this out at https://www.google.com/teapot.

Frameworks like Node.JS and Golang allow you to return 418 as a status code, even if it’s not standardized.

If you are using express.js, you can set the status code as 418 for your response as in the image.

‌There is also a website https://save418.com/, which plea’s not to remove the 418 status code but wants to standardize it. Even though it has no technical meaning, but it’s fun to have it in the specification as it has been a part of the specification unofficially for a long time. Many servers may break if removed. You can implement this status code as an Easter egg on your website as well.