404 and Other Errors
Apart from the 404 error, how many other HTML error pages do you know about? Have you ever thought about what happens in the background when you see any of these HTML error pages on your screen?
Those codes are meant to convey important information to the user. It can be useful to know them better, especially if you are a website owner/operator. Using them properly reduces your bounce rate, improves your search engine ranking and gives you knowledge on the performance of your site.
Understanding Status Codes
Behind every error page you see on the web there is an HTTP status code sent by the web server (unless they’re hidden using custom error pages). Status codes come in the format of 3 digit numbers. The first digit marks the class of the status code:
1XX status codes have informational purposes
2XX indicates success
3XX is for redirection
None of these three classes result in an HTML error page as in this cases the client knows exactly what to do and goes on with the request without hesitation. What we usually see are the 4XX and 5XX ones:
4XX represent client-side (request) errors
5XX indicate problems on the server side
In these cases, HTML error pages are displayed mainly because the client has no idea about what how to move on. Let’s see what happens in the background when something goes south and what you can do about it.
Client-Side Errors (4XX)
400 – Bad Request
Whenever the client sends a request the server is unable to understand, the 400 Bad Request error page shows up. It usually happens when the data sent by the browser doesn’t respect the rules of the HTTP protocol, so the web server is clueless about how to process a request containing a malformed syntax.
When you see a 400 error page the reason is most likely that there’s something unstable on the client side: a not sufficiently protected operating system, an unstable internet connection, a defective browser or a caching problem. So before panicking it’s always a good idea to make sure your internet connection and web browser work as intended.
Open the same web page in a different browser, clear the cache, and check if you are due with security updates. If you regularly meet the 400 error on different sites, your PC or Mac needs a thorough security checkup.
401 – Authorization Required
When there’s a password-protected web page behind the client’s request, the server responds with a 401 Authorization Required code. 401 doesn’t return a classical error message at once, but a popup that asks the user to provide a login-password combination.
If you have the credentials, everything is all right, and you can go on without any problem and get access to the protected site. Otherwise, you are redirected to the Authorization Required error page.
If you are a website owner, you can add the same password-protection to your site or a part of it through your cPanel account.
Password Protection in cPanel
Click on the “Password Protect Directories” submenu inside the “Security” menu box and choose the web folder you want to protect. It can be a good security layer to restrict access to your admin area like the wp-admin folder in a WordPress site.
403 – Forbidden
This indicates a fundamental access problem that’s possibly difficult to resolve because the HTTP protocol allows the server to give this response without providing a reason. It’s basically just a big ‘NO’ from the Web server and allows no further discussion.
By far the most common reason for this error is that browsing of directories for the site is forbidden. Most sites want you to navigate using the URLs in the Web pages and not the internal folder structure.
If the entire site is protected in some way, a 401 – Not authorized (not authorized) message can be expected. It’s possible, but unlikely, that the Web server instead issues the 403 message.
Some Web servers can issue the 403 error when they previously hosted the site, but no longer do. In this case, it’s not uncommon that the 403 error is issued in place of a more helpful error. Therefore if you have recently changed any aspect of your website (eg changing hosting provider), then a 403 message is possible.
404 – Not Found
The most famous and widely known 404 error page is primarily a page which informs the user of the absence of the requested resource. If a user follows, for example, a link whose target page no longer exists then the so-called 404 error page appears.
Most bigger and well looked-after websites have custom 404 error pages or just as simply redirect back to the homepage. This improves user experience, allows for custom error logging and overall is looks more professional. If you own an active website and want to improve your error handling, custom 404 page is a first thing you should look into.
429 – Too Many Requests
Although rarely seen, this error appears when the server receives too many requests to handle at the same time. This can be configured and appear globally or per user basis. You can usually see them when a website receive a huge, unplanned and unaccounted for number of connections that can be either organic (website just launched, an advertisement campaign was launched etc.) or malicious (DDoS attack).
If you’re an owner of an active website start seeing reports of this error, you should look into it ASAP as there’s a big possibility that your website is under a DDoS attack or generally unreachable for the public.
Server-Side Errors (5XX)
500 – Internal Server Error
The Web server (running the site) encountered an unexpected condition which prevented it from fulfilling the request from the client (your browser). These errors can usually only be resolved by server maintenance and is not the web clients fault.
502 – Bad Gateway
This usually doesn’t mean that the upstream server is down (no response to the gateway / proxy), but that an upstream server or gateway / proxy is unable to communicate the data. If you surf the web and see this error with all the sites you try to visit then either your ISP has an equipment failure / maintenance / overload or there is something wrong with your internal internet connection, for example, your firewall isn’t configured correctly.
503 – Service Unavailable
503 error means that the web server is, due to a temporary overloading or maintenance, unable to fulfill HTTP requests. The implication is that this is a temporary condition that should be resolved shortly.
The web server is actually ‘closed for repairs’. It still works minimally because it can at least respond with a 503 status code, but a full service is not happening and the site is simply unavailable. There are endless reasons, but generally, they occur due to any human intervention by the operator/admin of the web server. You can usually expect that someone is working on the problem and normal service will resume shortly.
504 – Gateway Timeout
The gateway server or proxy did not receive a timely response from an upstream server to which it accessed to process your HTTP request. This usually means that the upstream server is down or taking a very long time to respond.
Most of the time this as an issue with the server – it’s either under heavy traffic or misconfigured. Also, this is a common issue when the site you’re accessing has internal code mistakes or bugs and is stuck on a loop fulfilling your request or completing other actions.