When you make a request to a web server, the server will respond with a status code. The status code indicates whether the request was successful or not, and if not, what the error was. There are lots of different HTTP response codes, which are three digit codes that generally align with the following classes:
- 100-199: Informational responses
- 200-299: Success codes
- 300-399: Data was received and redirected
- 400-499: Client errors (although like if a page isn’t found on a web server, the server is telling the client that it requested a resource that doesn’t exist)
- 500-599: Server errors when trying to process data sent by the client
Of these, some of the most common ones we run into include the following:
- 200 OK: This means that the request was successful and the requested resource was found. Since the advent of REST, many of the other 200 codes aren’t used as an event body often contains the information they were otherwise designed to convey.
- 201 Created: Means that a request was successful and a resource was created.
- 204 No Content: Like a 200 but indicates there’s no need for a response.
- 205 Reset Content: Resets the state, like when a browser wants to clear the cache from a web form.
- 206 Partial Content: Usually from a caching service and instructs the client to get another payload of data.
- 300 Multiple: There was a redirect and the response indicates where to look for the redirect.
- 301 Permanent Move: A page is responding that it has permanently moved and the client should look for the location in the response.
- 404 Not Found: This means that the requested resource was not found.
- 401 Unauthorized: This means that you are not authorized to access the requested resource.
- 403 Forbidden: This means that you are not allowed to access the requested resource.
- 408 Timeout: The client didn’t complete the request before the server’s timeout was hit.
- 415 Unsupported Media Type: There was a request to an address that exists but it wasn’t in a supported format.
- 500 Internal Server Error: This means that there was an error on the server side.
- 503 Service Unavailable: Usually indicates the server is too busy (e.g. needs more resources to process the request).
- 505 HTTP Version Not Supported: Using a version of http the server can’t interpret.
HTTP response codes are typically more used by web developers (and web browser developers) to bettter understand the status of a request and to take appropriate action. For example, if a request returns a 404 Not Found status code, the web developer might display a message to the user indicating that the requested resource was not found, like a page with a fail whale. By far, this is the most common code an end user will see, as nearly every web server that listens for requests for a domain has a 404 page – and often customized. Some even break down if the resource being called was deleted or moved and sometimes even a search box to find the right resource. With the amount of pages dynamically generated, it happens often when a butterfly flaps its wings in a category name change on a blog or someone just takes a page down.