HTML Status Codes

There are 5 types of common code types used in HTML. The first 3 types are informational used in coding and for services such as what search engines know. Considered more passive than active as they don't result directly in any kind of “page” that the end user will see. The second type many AJAX coders will recognize as they are the success / failure messages from the server during the different stages of an AJAX call.

The last two are the ones users are generally acquainted with. Considered the error types that result in some kind of error page (sometimes cryptic) the user sees. A common one is the ever popular 404 error described below.

400 – Bad Request

When a client sends a request the server is unable to understand, this page is called. A common reason is data that the user’s browser sends to the server which doesn’t respect the HTML protocol rules. Other reasons range from a bad or corrupted browser cache, unstable internet connection, or some other kind of unstable client side error.

401 – Authorization Required

A common page in security where the requested page requires some kind of login in order to access the contents of that page or directory. Most hosting services provide an easy way to protect those files and directories, yet for programmers it shouldn’t be the only line of defense and a second type or alternate form of login is advised. Early stage CMSs back in the day used this form until a more secure login type was created. This is one reason the practice is fading a bit although still used for quick and dirty protection of sensitive or semi-sensitive data.

403 – Forbidden

A purposeful message from the server, not technically an error. Everything is understood and processed by the server but will give the user a stern “I don’t think so” indicating that the website owner clearly doesn't want anyone to have access. This is most commonly used to protect the directory listing itself. Allowing them to use and view the files but unable to either see the directory structure or the server side source code. Apache servers have a special htaccess section that easily allows for this kind of directory / file protection.

404 – Not Found

With the web being a living breathing entity, this is one of the more common errors almost every user will know about. Website owners and developers that temporarily remove a file or are in the middle of transitioning pages will generate this kind of error when the page or image is currently unavailable. An example might be a menu item that points to an outdated link or maybe an external link that is no longer there for one reason or another.

405 – Method Not Allowed

Generally indicating that the method of calling a certain page is, well, not allowed. A common reason might be either the GET or POST methods for passing data to a page. Some sites do not allow for things like URL variable parameters (the funky sometimes cryptic things after the .html in the address bar, google and youtube both use them) so anyone attempting to call a page with those parameters might see this kind of page if the website owner decides not to allow it.

408 – Request Time-Out

Some call it the cobweb error. It happens when the client side takes too long to send it’s request to the server. Think the treant and the hobbit, where the server just wants to go but is caught just waiting for the browser to send the request. Several things can cause this kind of error but the most common would be where your phone’s nice 4G connection drops of to the 1x speeds. This is also a server side adjustment to protect the connection against drop offs … someone that just looses their internet but the server’s connection is still open. Allowing the connection to close and be used by someone else.

410 – Gone

This is 404’s lesser known cousin. Where the page or file is just plane Gone. Unlike 404 which suggests that the file might be somewhere else and a refresh might help, 410 indicates that the file is permanently gone from the server. Server owners may couple this with a 301 redirect code indicating that the current page is no longer available so go here for the new data.

500 – Internal Server Error

As it’s name suggests, this error is a problem with the server. Encountering an internal error or unexpected condition preventing it from sending the data to the browser. This is also a general error when no other 5xx error code applies.

502 – Bad Gateway

Not all data resides on a single server, some website owners rely on external servers to host some of the data. The user will get a 502 error when communication between those servers is interrupted or cut for a variety of reasons. An example might be fonts that are hosted on some other server and that server goes down or the connection is otherwise interrupted.

503 – Service Temporarily Unavailable

Servers occasionally get overloaded at which time the user will probably see this type of error. Sometimes it might show as Out of Resources depending on the type of overload and server settings. Basically it means that the server is temporarily not available and a small wait and refresh usually clears it up.

504 – Gateway Time-Out

Common on shared hosting services, this error appears when there is some kind of upstream error or connection interruption that causes the higher-level server to not serve up the resources needed by the lower level one.