418

I'm a teapot

Official
The coffee could not be made with a teapot

General explanation of the 418 status code

The HTTP status code 418 I'm a teapot is due to an April Fool's joke from 1998 and does not really exist in the real World Wide Web. Even in modern times, the status code 418 I'm a teapot is often used on April 1st, for example by Google and other large websites.

Specification of the HTTP status code 418

Any attempt to brew coffee with a teapot should result in the error code 418 I'm a teapot. The resulting entity body MAY be short and stout.

Source / Quote by: The 418 I'm a teapot HTTP Status Code is specified by section 2.3.2 of RFC2324.

How to throw a 418 statuscode with PHP?

To throw the HTTP status code 418 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(418) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 418 HTTP status code

In order to be able to display the HTTP status code (in this case 418 I'm a teapot) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 418 I'm a teapot
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=418
Status: 418 I'm a teapot
Those: Network
IP address: XX.XX.XX.XX
Status code 418 I'm a teapot

How to create a custom error page for the 418 status code

Creating your own 418 I'm a teapot error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 418 I'm a teapot error page in "Apache", the following change must be made in the following file.

File: .htaccess
ErrorDocument 418 /errors/418.html

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 418 I'm a teapot error page in "NGINX", the following change must be made in the following file.

File: sites-enabled/default
error_page 418 /418.html;
location = /418.html {
    root /usr/share/nginx/html;
    internal;
}

Browser compatibility of the 418 status code

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Constants in programming languages

http.StatusTeapot
Response::HTTP_I_AM_A_TEAPOT

Blog Articles

SEO and HTTP status codes: A comprehensive analysis

Optimizing a website for search engines (SEO) is a complex undertaking. One of the often overlooked but crucial aspects for a good ranking are HTTP status codes. These small, three-digit codes info...

HTTP Statuscode 418: Im a teapot - From joke to cult status

In the technical and often austere world of internet protocols, one code in particular stands out: the HTTP status code 418, nicknamed "I'm a teapot". But behind this seemingly nonsensical status c...

Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub