Is 418 “I’m a teapot” really an HTTP response code?

I use this code. I have nginx reverse-proxying requests to two separate HTTP servers. One handles requests for unauthenticated users, and the second handles requests for authenticated users. The problem in this particular case, is the first server is the one that determines if the user is authenticated. Please don’t ask why.

So, if the first server determines the user is authenticated, it responds 418 I'm a teapot. NGINX then reroutes the traffic internally to the second server. As far as the browser is concerned, it was a single request.

This is in the spirit of HTCPCP code 418, because if you attempt to BREW with a teapot, the appropriate response is “I’m not the kind of thing that can handle that request, but there may be others.” .. In other words, “I’m a teapot. Find a coffee maker.” (the second server being the coffee maker).

Ultimately, while 418 is not explicitly defined in RFC 7231, it is still covered by the umbrella of 4xx (Client Error).

6. Response Status Codes

  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled

6.5. Client Error 4xx

  • The 4xx (Client Error) class of status code indicates that the client
    seems to have erred. Except when responding to a HEAD request, the
    server SHOULD send a representation containing an explanation of the
    error situation, and whether it is a temporary or permanent
    condition. These status codes are applicable to any request method.
    User agents SHOULD display any included representation to the user.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)