HTTP Status Codes: The Full Guide
There’s nothing more frustrating than being met with an error code on a site. Whether it’s a redirect error, or the server simply can’t be reached, being met with a server response code and not understanding what it means or how to resolve it can be a disheartening experience, particularly when it comes to our own websites. To help you resolve the issues, we’ve spoken to our web design experts to compile a guide to the codes you need to know.
If you’d like any more information on resolving these issues, feel free to get in touch with a member of our team on 0800 088 6000, today.
What Are HTTP Status Codes
Every website online is hosted on a web server, and so whenever you click on a link or enter a URL on browser, you are submitting a request via your browser to that server. Once this has been received, it is returned and processed, before the server then sends back the requested resources – i.e. the webpage – and relevant HTTP headers. This is where the status codes come in.
With every header comes the HTTP status code, however you won’t always see them. In fact, in a lot of cases, this won’t be visible at all. When things go wrong, however, you may be given the code on the webpage itself in order to explain what happened. However, with so many codes out there, determine what each code means isn’t always simple. That’s where this guide comes in.
What Do The HTTP Status Codes Mean?
There are five different sets of codes: informational responses, success codes, redirection codes, client error codes and server error codes. While informational and success codes are typically the least often seen, understanding what they mean regardless can offer peace of mind if they do happen to pop up. Here are the five code types and their numbers:
1xxs – Informational Responses
1xx response codes typically refer to informational responses, informing the user that the request is still ongoing successfully in one way or another. This usually means that the browser is continuing with the request and everything is in order. The common informational responses include:
- 100 – Continue
This indicates that everything is going fine and that the client in question can continue with the request. They can also ignore this if the action is already finished.
- 101 – Switching Protocol
The 101 status code is sent in response to an Upgrade request header. The client will send this to show the protocol that the server is switching to.
- 102 – Processing
This particular code shows that the server is processing the request but there has been no response yet.
2xxs – Success
Success codes, otherwise known as 2xx codes, are given when the browser has successfully received the request, and the server has gone on to understand and process it. The most common 2xx codes include:
- 200 – OK
This particular code simply means that the request made has succeeded. The HTTP Method will change the general meaning of success, but typically equates to one of the following:
- GET – This means that the resource requested has been fetched, and that it has been transmitted into the message body.
- HEAD – This shows that the entity headers are in the message body.
- PUT or POST – This shows that the resource describing the result of the action has been transmitted into the message body.
- TRACE – This contains the request message as it was received by the server.
- 201 – Created
This status code shows that a new resource has been created as a result of the request that has been made. Typically, you will receive this response after a POST request though it has been known to show after a PUT request in some cases.
- 202 – Accepted
This particular status code is typically only utilised for bath processing, or in cases where another process or server will handle the following request. It showcases that a request has been received but hasn’t had any action yet, and is therefore completely non-committal. There is no way to send an asynchronous response in HTTP that indicates the eventual outcome of processing the request.
- 203 – Non-Authoritative Information
If you receive a 203 status code, this means that the meta-information returned to you has been collected from a local or third party as it is not an exact set that would be available from the origin server.
- 204 – No Content
This particular code simply means that there is no content available to send for the request. In this case, headers may be useful, but this will depend on the request being made at the time.
- 205 – Reset Content
This status response tells the client that it needs to reset the document view. This is typically used for clearing content within a form, refreshing the UI or resetting a canvas state.
- 206 – Partial Content
This is a success code that shows the requested ranges of data have successfully been added to the body. The ranges of data will be described within the Range header of the request.
3xxs – Redirection
3xx codes refer to any status response code associated with redirects. They are given when a new resource has been substituted for the original, or where the requested resources has been moved elsewhere. Common redirection status codes include:
- 300 – Multiple Choice
This redirection request gives the user or user-agent multiple choices as to where the redirect will go. There is no standard way of choosing the response channel, and as a result, it is rarely used within HTML today. If the server at hand has a preferred choice, a ‘Location’ header can be used or generated.
- 301 – Moved Permanently
A 301 status code tells us that the resource and URL requested has been permanently moved to the indicated URL. A browser will naturally redirect to this location and any search engines will automatically update the listed URL.
- 302 – Found
This status response code will show that the resource has been temporarily moved to a new URL and may be prone to further change in the future. In these cases, the browser will redirect to the new URL, but a search engine won’t index the new URL.
- 303 – See Other
Generally, this code indicates that the redirect will not lead to the new location of the resource, and instead a different page completely. This can include confirmation pages, upload progress pages and more.
- 304 – Not Modified
This is essentially an implicit redirection to a cached resource, indicating that there is no need to retransmit the requested resources. This typically only occurs when the request method is considered safe or when the request is conditional.
- 307 – Temporary Redirect
This is another temporary redirect status code, showing that the resource that has been requested has been temporarily moved to a new URL. Unlike a 302 error, however, a 307 will guarantee that the method and the body will not be changed as a result of the request. Therefore, 307 codes are more predictable.
- 308 – Permanent Redirect
Similar to a 301 request, this status code means that the resource has been permanently moved to a new URL. Unlike 301, however, it requires the request method to remain the same (e.g. PUT, GET, POST, etc.) There are some cases where a 308 response code will not equate to ‘permanent redirect’, such as Google’s ‘Resume Incomplete’ 308 code.
4xxs – Client Errors
We’ve all come across 403 and 404 errors, but did you know there are more client errors than just those two? 4xx server response codes indicate that there has been a problem with the request, and that it could not be completed.
- 400 – Bad Request
Simply put, this status code shows that the server couldn’t understand the request that was made and cannot process the request for this reason. Some client errors can include incorrect syntax, invalid message framing or deceptive routing.
- 401 – Unauthorised
If the request lacks valid authentication and is considered unauthorised, you may receive a 401 error. Any invalid credentials within the request or the target resource can lead to an unapplied request however, authentication may still be possible.
- 403 – Forbidden
Similar to a 401 error code, a 403 code indicates that the server did understand the request, but would not authorise it. Re-authenticating will not work in these cases, as the access is strictly and permanently forbidden and can often be due to insufficient rights to access a resource.
- 404 – Not Found
A 404 error code shows that the server cannot find the resource that was requested by the client. This will not indicate whether the resource has been temporarily lost or permanently removed, however it’s suggested that a 410 error is used in the case of a permanent removal instead.
- 405 – Method Not Allowed
This error code means that, while the server understands the request, the method may have been disabled and therefore cannot be authorised or used. Some servers and APIs may restrict or forbid certain actions, such as deleting resources.
- 406 – Not Acceptable
You’ll receive this error if the server can’t produce a response that matches any of the acceptable values that have been previously defined. These will usually be found in the proactive content negotiation headers, which can include ‘Accept’, ‘Accept-Charset’, ‘Accept-Encoding’ and ‘Accept-Language’.
- 407 – Proxy Authentication Required
This particular code is similar to a 401 error, but will require authentication from a proxy located between the browser and the server and that can access the requested resource effectively.
- 408 – Request Timeout
This error will appear when a server wishes to close down an unused or idle connection between itself and a client. In some cases, this can even be shown without any previous request needing to be made by the client, and can indicate that it has decided to close the connection, rather than opting to continue waiting for a response.
- 409 – Conflict
A 409 code indicates that there is a request conflict on the server. They are most likely to occur when putting in a PUT request, such as when you’re uploading files that may be of an older version than the resource currently live.
- 410 – Gone
If the resource is no longer available and this is a permanent condition, then a 410 error should be use. If the loss is temporary or you are unsure as to whether it is permanent or temporary, you can utilise a 404 status code.
- 411 – Length Required
In some cases, if you lack a Content-Length header, you may find yourself faced with a 411 error. This indicates that the server has rejected the request due to a lack of definition for the required header field.
- 412 – Precondition Failed
This indicates that access has been denied to the target resource, due to certain preconditioned header requirements not being fulfilled. These are typically If-Unmodified-Since and If-None-Match headers.
- 413 – Payload Too Large
If you receive this status code, it indicates that the request entity exceeds the limits that have been defined and set by the server. This error is typically followed by the closing of the connection, but can offer a ‘Retry-After’ header field.
- 414 – URL Too Long
This particular error code isn’t overly common, but typically occurs when the server deems the URL too long to interpret. This will differ depending on the servers, but can also occur in rare conditions such as:
- When the client had failed to properly convert a POST request into a GET request.
- When there is a loop of redirection
- When the server is under attack
- 415 – Unsupported Media Type
A 415 error code shows that the server is unable to or refuses to accept the request from the client, due to the media being in an unsupported format.
- 416 – Requested Range Not Satisfiable
This error response code indicates that a server cannot handle the requested range. In most cases, this is because the document doesn’t actually contain the range, however it can be that the header doesn’t make sense.
- 417 – Expectation Failed
This code simply indicates that the expectation given in the ‘Expect’ header could not be fulfilled.
- 418 – I’m A Teapot
If you receive this error code, say goodbye to your morning coffee! The I’m A Teapot error code was an April Fools’ joke back in 1998, that indicated the server would ‘refuse to brew coffee because it is a teapot’.
- 421 – Misdirected Requested
This error code will occur if a server is not able to produce a response, usually if the server is not set up to produce responses for the request URL.
- 425 – Too Early
When a server is unwilling to process a request due to the risk of it being replayed and creating a replay attack, you may be given a 425 error code.
- 426 – Upgrade Required
This particular error code means that server is unable or refusing to process a request but may be able to do so after an update. Upgrading protocols may be the solution in these cases, particularly if the server sends an ‘Upgrade’ header with a 426 response.
- 428 – Precondition Required
This error code means that the request was unable to be processed as the server requires the request to be conditional. This can often flag up if the ‘If-Match’ header is missing.
- 429 – Too Many Requests
Most servers have a request limit, and if you receive a 429 error, it’s likely that you’ve reached it. It indicates that the user has send too many requests in a particular amount of time.
- 431 – Request Header Fields Too Large
This means that the server is unwilling or unable to process the request as the headers are considered too large. This can be resubmitted once it has been resolved in some cases.
- 451 – Unavailable For Legal Reasons
This one is self-explanatory – if you receive a 451 error code, this means that the resource you are trying to access has been made unavailable due to legal proceedings, e.g. a government document.
5xxs – Server Errors
5xx error codes tend to indicate that the request has been received and understood, but there has been an issue in completing and fulfilling it. Common 5xx codes include:
- 500 – Internal Server Error
This particular code encompasses any potential errors that the server may not understand or be able to resolve. It’s essentially a generic status response and in some cases, you may receive a little more information about the error to give you a better idea as how to solve the issue.
- 501 – Not Implemented
The request is not supported by the server and/or can’t be handled at that time. Generally speaking, the only required methods that a server needs to cater to are GET and HEAD, and so other methods may be rejected, leading to this status code.
- 502 – Bad Gateway
This error code will be given when the server is acting as a gateway or proxy and receives an invalid response.
- 503 – Service Unavailable
This status code simply means that the server is unable or simply not ready to process the request on hand. A server could be down due to maintenance or because it’s been overloaded. This usually refers to temporary issues, so can be resolved relatively easily when a Retry-After HTTP header is utilised with an estimated time for recovery.
- 504 – Gateway Timeout
You’ll receive this status response code if the server did not get a response in time when acting as a gateway or proxy.
- 505 – HTTP Version Not Supported
This one is relatively self-explanatory – you’ll get this response code when the HTTP version used during the request isn’t supported by the server that is processing it.
- 511 – Network Authentication Required
This status code indicates that the client need authentication before it can gain network access. In some cases, networks may require different levels of authentication, including term acceptance, interaction and more (e.g. signing up for Wi-Fi access).
Receiving an unknown status code can be confusing, but with this guide, you can determine what’s going wrong with your server requests and set on your way to resolving the issues. Our web development team here at Absolute Digital Media are well versed in status response codes and the most effective solutions for errors – for more information, you can get in touch with them on 0800 088 6000.