A Beginner's Guide to HTTP Status Codes
If you're reading this blog post, I can accurately assume that you're someone who is on the internet with relative regularly. Piggy-backing off of that assumption, we can also assume that you've encountered at least one of the numerous HTTP status codes.
An HTTP status code is, in short, a standard response code issued by the server that shows a relation between the client's request (e.g., visiting a webpage) and the server. Due to the complexity of the workings behind a website there is a whole slew of HTTP status codes you could come across while casually browsing the internet, from the infamous 404 response code that means the resource(s) couldn't be found, to the less commonly known 451 response code, which denotes that the resource is unavailable, but specifically for legal reasons.
One thing to note about these codes is that they are, for the most part, something you won't actually see when visiting a website. They are a response that the server sends to your browser so it can understand the resources requested, and mostly happen in the background of whatever you're doing. This isn't the case for all of them but is true for the majority.
HTTP response codes are broken down into five major classes or categories based on the first digit of the code. Those categories are as follows:
Each category comes with several individual response codes that all mean something different (however slightly), but they all fall within one of these five categories. The ones seen most commonly are 3XX and 4XX response codes—except for the case of the 200 response code, which is absolutely the most common and will be discussed below in the section regarding 2XX response codes.
A quick aside about the lists below: they are technically incomplete and could change at a moment's notice. Although most of the codes discussed have been the standard for years, there is always the possibility of some being added, removed, or changed, so please be aware of that. On the note of them being "technically incomplete," I say this just because it would be a waste of both your time and my time to put every single one of them on this list—some of which you should never, ever encounter.
Informational (1XX) Response Codes
These codes are some you as a consumer of the internet should never see, so we won't spend a ton of time on them. These codes indicate that the request was received and understood by the hosting server and are generally used for experimental and testing conditions only. If you see a 1XX response code on your website, you should contact your webmaster to ensure that it is resolved.
Success (2XX) Response Codes
Success codes are most commonly seen on the internet with everyday use. This class of codes indicates that the action requested was received, understood, and accepted by the server. The most commonly used of these codes is the 200 status code.
200 Status Code
The 200 status code is also referred to as the "OK" status code. This code indicates that the request to the server was successful and generally means that whatever web page you're trying to visit was found correctly and is able to be loaded by your client (in this case, the web browser). The 200 code is received by your browser in such a way that you will never actually see the response—but if the webpage loads, you can assume you got this code, or the 301 code, which will be explained later in this article.
Redirection (3XX) Response Codes
The 3XX class of response codes is arguably the one that causes the most headaches, but they can be increasingly useful as your website and internet marketing ventures mature. These codes tell your browser that the request they have made has moved to a different location, either temporarily or permanently. In some cases, you might see that these codes are due to getting a new website with different URLs, resources changing, moving, being modified, or the website attempting to point you at different information.
301 Status Code
This is the most common 3XX code we see in our line of work, and it's referred to as the "Moved Permanently" status code. If your browser gets this code, it's likely that you won't see any major changes in the way the website you're visiting functions—it'll probably just load a webpage. What's happening behind the scenes, however, is that your browser tried to visit location X, and the server told it to route that request to location Y now and in the future. This is a common case in websites that get new URLs for old pages, or when you have multiple URLs that need to go to the same place (e.g., "https://www.yourwebsite.com/blog" and "www.yourwebsite.com/blog"), or if you would like to direct traffic to another URL owned by the same organization.
302 Status Code
This is the second most commonly seen 3XX code and is referred to as the "Moved Temporarily" status code. As the name implies, it tells the browser that a resource that has been requested has moved temporarily, rather than permanently like the 301 code. This is useful for SEO purposes if you'd like search engines to hold onto the old URL. Now, it's generally believed that there are few logical uses for a 302 status code, and that you probably meant to use a 301 code when you set up this redirect, so be wary when using them. The idea behind this comes in asking yourself the simple question of, "Why would I need to only move this page/resource temporarily?"
Client Error (4XX) Response Codes
This class of response code could be argued to be the second most common, due to the infamous 404 response code that is the most common on the internet. These codes are intended for situations in which the error seems to be coming from the client (i.e., the web browser); it could be a case of a poorly formatted URL or simply visiting a page that doesn't exist.
400 Status Code
The 400 status code indicates a "Bad Request." This means the server cannot or will not process the request, which could mean several things: the request could be malformed or too large, the request framing could be invalid, or the routing could be deceptive. These codes aren't very commonly seen, but they usually mean that you, as the user of the internet, have made a misstep.
403 Status Code
Also known as the "Forbidden" status code, a 403 code simply means that your request was valid, but the server responded by saying you aren't allowed to access the resource(s) you've requested. This could mean that you don't have the proper security clearance to access the resource, you entered a bad HTTP password, or the resource is blocked from your specific IP address. If you encounter this code and you believe you shouldn't have, you should contact the webmaster of the website to remedy the situation.
404 Status Code
We've finally made it to the status code I'm sure everyone has seen—maybe even today, and maybe even on this very website. The 404 "Not Found" response indicates that whatever request was made to the server could not be found at the time of the request. This code is usually paired with a specific page on the website, often referred to as a "404 page," which can help the user to find the resource they were looking for, or simply to allow the user to stay on the website that the request was made to so they still have access to the main navigation and can continue browsing the website.
451 Status Code
I figured since I mentioned this one, I had to include it on this list. The 451 response code, or "Unavailable for Legal Reasons" is a code I've never personally run into, but that doesn't mean that it isn't around. This code usually means that the webmaster has received a legal demand to deny access to a resource or set of resources.
Server Error (5XX) Response Codes
The 5XX family of server response codes indicates that the server could not complete your request, of its own inability. These indicate that the server is aware that there is a problem, error, or bug, and instead of attempting to fulfill a request, it responds by letting the client know that it is unable to fulfill the request. This is due to no fault of the client (you or your browser) and is generally because someone controlling, maintaining, or coding the website has made an error.
500 Status Code
This is a generic response code that a server can give when there is an "Internal Server Error." This nondescript code is usually just a way for the server to let you know it has no idea what to do with your request internally and could not complete it.
503 Status Code
This code, similar to the 302 status code above, is generally a temporary code that denotes "Service Unavailable." This generally means the server is overloaded and couldn't complete your request, or that the server is down for maintenance. This is another code that if you're seeing it on your website, and you believe it's in error, you should contact your webmaster immediately.
504 Status Code
The 504 response is a gateway timeout response code. This means that the server attempted to fulfill your request, but took too long to do so, and returned this response instead. Generally, this is because the server is acting as a gateway, or relay, to another resource and didn't get a timely response from that other resource.
HTTP Response codes are something that we encounter tens (if not hundreds) of times a day, whether we're aware of it or not. Most codes won't ever require you to even think once about them—but if you do end up encountering any of these error codes, your best course of action is to contact the webmaster of the website and inform them of the problem and to let them take care of it.
If you have an error on your website, the development team here at Armor Techs is more than happy to take a look at it for you, diagnose the problem, and work with you to find the best solution for said problem. Stop by or contact us today to start that process and get your website running better than ever!