A HTTP header is sent from a web server when a request is made by a web browser to view a page or to access a resource on a website. The HTTP status code(s) get included in the HTTP header too. These provide vital information about the page request – sometimes good and sometimes not so good.
Depending on the code(s) received, the web browser reads them and will sometimes provide information to the web surfer. Perhaps the best known one is: 404 error – page not found. However, scores of other status codes exist too.
How Many HTTP Status Codes Are There?
There are more than forty status codes. Many are seldom used and unfamiliar. There are also 10+ that are regularly used.
For instance, if you surf to a domain “WHOIS” lookup facility to check the owner on a domain name, along with the registration details for the domain, the page may also show whether the site is currently live or dormant. This information comes from an HTTP status code when the home page was requested.
HTTP Status Codes Are Grouped Together
There are five status code classes. Codes are three digits and start with a 1, 2, 3, 4 or 5.
The five classes are as follows:
- 1XX – Update codes telling the web browser that the page/website is continuing to be requested. They’re used purely to inform the browser and aren’t directly passed on to the end user.
- 2XX – Returned by a web server to indicate (some) success with a request for a page, script, image file, etc.
- 3XX– Confirmed when redirecting in some manner. i.e. com/abc redirects to mysite.com/a-b-c.html
- 4XX – The request is flagged as problematic. Usually this is a client-side problem, i.e. a 404 error when requesting a page on a website where the page does not exist.
- 5XX – Request accepted but there is a server-related problem preventing its completion. Specifically, a server-side issue.
The Most Relevant HTTP Status Codes to Understand
Each three-digit status code narrows down specifically what is wrong with a page or website request made using a web browser. For instance, with a 3XX redirection code like a 301 or 302 HTTP status code, these both relate to a page being redirected to a different web address (URL) but the exact meaning is not identical. Therefore, the codes are subtly different yet still fall under the same class.
Here are the most important status codes to know:
Status Code – 200
This is a status code to say all is good. No problems whatsoever with the request.
Status Code – 301
A 301-redirection code indicates the page or resource has moved permanently to another location. It is set up on the web server to redirect requests to a secondary location.
Status Code – 302
A 302-redirection code is for pages or resources that were not where they were expected to be but have been relocated. This is set up on the server side as a temporary redirection.
Status Code – 304
A 304-redirection code indicative of a web server saying that the page or resource is unchanged from the previous occasion that the web browser looked it up. Also, it confirms that the cached (saved) version of the page in the web browser still matches the live version. This code helps avoid downloading the same page repeatedly when the web browser already has a saved version of it. Therefore, it redirects the request back from the web server, in that respect.
Status Code – 401
The 401-status code is used to indicate when no authentication (username and password, typically) has been entered to legitimately access the page or resource.
Status Code – 403
With the 403 code, the server has blocked access to the resource because it is not permitted. This is usually trigged when entering an incorrect username/password combination on a page or resource that’s hidden behind a security lockout.
Status Code – 404
The infamous 404 error code tells the web browser that the page or resource could not be found. It also indirectly indicates that the web server may never have seen the page or resource previously either. Most likely, the page or resource was incorrectly typed into the web browser’s address bar.
Status Code – 405
The 405-error code relates to a method that’s not permitted. This can be caused when a page is requesting access to a secondary resource that was not allowed. Usually with a 405 error, it confirms that the resource is present (otherwise it would be a 404 error) but that the method used to request it was not valid or permitted. 405 errors are troublesome to resolve.
Status Code – 406
With the 406 error, the web server is communicating that the response it can provide doesn’t match what is expected by the web browser. The browser sends “Accept” headers which indicate what it is expecting to receive from the web server and that the two aren’t matching up.
Status Code – 408
The 408-error code occurs when only a portion of the complete request was received. Sometimes this happens because of a poor internet connection and other times because the web server is set to time out too quickly.
Status Code – 410
The 410-error code confirms that the page or resource is no longer present. It is like a 404 error; however, it is providing information suggesting that the page or resource was previously available whereas a 404 error doesn’t necessarily confirm that fact.
Status Code – 429
The 429- error code happens when the web server has received the maximum accepted requests from the web browser within a limited time. The limitation is set on the server to prevent too many server resources being used by scripts, or automated programmed bots that access websites autonomously.
Status Code – 499
The 499-error code occurs when a previous request was terminated on the client-side. This is often because the browser tab or web browser itself was closed before the page was loaded. The code in the server logs helps understand what happened with that request.
Status Code – 500
With the 500-error code, this indicates that an error occurred on the server. It happens most often when a script or resource could not successfully open a database connection in the data center to look up information or log a known user into the site. Because of the server-related issue with a page request, it could not be completed and so it returns a 500-error code to confirm this.
We hope that this detailed breakdown of the different HTTP status codes helps you to better understand what they are, why they exist, and how they’re helpful. Ultimately, most of the codes are never shown to the web user and just let the web browsing app know what is happening. Without them, the software would be unclear whether a request for a web page was successfully received, is being processed, or stalled halfway through with an error. As such, they’re invaluable for the web but go largely unseen.