Http Status Code

Everyone has been there. You are scrolling through Google search results, you find the site in question, but rather than being met with the result you wanted, you are met with a server error.

Whenever you click on a link, submit a form, or enter a url in the address bar your browser sends a request to the server where the site is hosted. In turn, the server sends a response back to let your browser know the status of that request. Most of the time this happens without you knowing, but when things go wrong you’ll get a 3-digit code telling you.

HTTP response status codes are separated into 5 categories, with each category representing the type of response. They begin with the numbers 1, 2, 3, 4 & 5 and are followed by two extra digits.

1xx Codes = Informational Requests 2xx Codes = Successful Requests 3xx Codes = Redirections 4xx Codes = Client Errors 5xx Codes = Server Errors

So what do they all mean? Here’s a list of the most common responses you may receive or hear when working on a development project and what they all mean.

Status Code 200 - OK
This is the one that happens all the time and means everything is fine. You’ll never see it unless you’re into analysing the devtools of your browser.

Status Code 301 - Moved Permanently
Otherwise known as a ‘permanent redirect’, or a ‘301 redirect’, this response code is used when a certain page no longer exists and the user is sent to a new page. This is another response that you won’t actually see apart from a change of address in the url.

Status Code 302 - Moved Temporarily Similar to a 301 redirect, this response simply tells your browser to go to a new specified page, but do so temporarily. The difference is that it tells your browser the redirect may be altered at any point.

Status Code 403 - Forbidden
Now comes the responses, and errors, you will see from time to time! A Forbidden response is the server's way of telling you that you don’t have the authorisation to access that content. For example when content is password protected and you’re not logged in.

Status Code 404 - Not Found
The best known response of all. We’ve all seen the ‘404 Not Found’ message. This response is simply telling your browser that there’s nothing there. The page, or the content, used to be there but has now moved, or been removed for some reason.

Status Code 500 - Internal Server Error
This response means that something is wrong with the server and it can’t handle the request. This isn’t a good error at all and normally involves trawling through the error logs of the server to find the source of the problem

Status Code 503 - Service Unavailable
A 503 response means that the server is temporarily unavailable. It could be down for maintenance, it could be overloaded or it could have failed during a routine restart. This can all normally be resolved by restarting the server.

A full list can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status