Telerik blogs

In this post, we’ll look at nine of the most common HTTP error codes, what they mean and what you can do to deal with them to minimize their impact on your website.

There are five categories of HTTP status codes. They let us know what’s going on when a request has been sent to the server:

  • 1xx codes mean that the request was received and is in progress.
  • 2xx codes mean that the request was successfully completed.
  • 3xx codes mean that the server was redirected as the original request could not be fulfilled.
  • 4xx codes mean that a client-side error occurred and that the request cannot be completed.
  • 5xx codes mean that a server-side error occurred and that the request cannot be completed.

It’s the latter two HTTP error codes we want to focus on today. Because when they occur, the user experience is at risk. There are dozens of these website error codes, so we’re going to break down nine of the most common ones, what they mean, and what you can do to prevent and/or resolve them.

How Do HTTP Errors Affect a Website?

Website errors—the ones reflected by HTTP error codes specifically—occur for a variety of reasons. For example, human error can lead visitors to encounter 404 errors and non-existent pages. Server issues like insufficient resources to process requests can lead to 504 errors and the timing out of a webpage. There are also software and security issues that can cause HTTP errors.

Regardless of why the errors occur, they can lead to a disruption of the users’ experience. And that can bring a whole host of issues for the website and the company that owns it:

  • Sites can lose traffic and sales when visitors encounter non-existent pages or unavailable websites.
  • SEO can be negatively impacted if the error persists for long enough.
  • Errors caused by security breaches can lead to additional harm, like stolen data.
  • Productivity plummets as you and your team drop everything to deal with the error.
  • The brand’s reputation can also take a hit, which can lead to a decrease in customer loyalty and retention.

It all depends on how severe the error is and how far-reaching it is on the website. Keep in mind that individual pages impacted by HTTP errors can be just as devastating as a website that’s gone offline. So keeping an eye out for all types of errors and having a system in place to permanently fix them is crucial.

What Are the Most Common HTTP Errors and What Can You Do About Them?

Creating a flawless user journey for website visitors goes beyond what they see and do with the UI. You also have to consider what happens on the backend and how it can create problems for them.

Let’s look at the most common HTTP error codes users encounter on websites and what you can do about each of them:

HTTP Error Code 400

Error message: 400 Bad Request

When does it happen: The 400 error means that there’s generally something wrong with the data on the client side of things (i.e., the browser or device). There are a number of reasons for this to happen:

  • A syntax error in the URL—either because the user typed it incorrectly or was given a bad URL.
  • The browser’s cached data or cookies are “stuck” and holding onto outdated or corrupted data.
  • The domain name service (DNS) records have outdated data.
  • The end user has an unstable internet connection.

What to do about it: Because this error is caused by something outside the website, there’s nothing to really fix. Instead, if someone encounters this error (be it you, a team member or a website visitor), you’ll want to walk them through a process of elimination.

First, check that it’s only your website that’s impacted and not all websites. If it’s all websites, then it’s due to a poor internet connection.

If it’s just your site, check that the syntax of the URL is valid.

If it’s correct, then have the user clear their browser’s cache, cookies and search history.

After restarting the browser, if they continue to experience issues, then have them clear the DNS cache on both their computer and browser. You’ll find a good summary of how to clear DNS cache on different OS here.

HTTP Error Code 401

Error message: 401 Unauthorized

When does it happen: This error code appears when someone tries to visit a part of a website they have no permission to access. This can happen:

  • If a user tries to access a password-protected page and fails to provide valid credentials.
  • If they try to access a restricted page or file that they weren’t supposed to have access to in the first place.

What to do about it: If someone isn’t supposed to access a protected part of the site, then there isn’t really anything you can do about that. These safeguards are in place for a reason.

That said, if something has been placed on the frontend of the site that shouldn’t be there, then you need to remove it. That’s why monitoring for the 401 error code is important. If you learn that numerous users are trying to open a file or page and encountering this error, then remove it and the frustration it brings to users ASAP.

HTTP Error Code 403

Error message: 403 Forbidden

When does it happen: This error code is similar to 401. The main difference is that the user has valid login credentials, but has tried to access a page or resource and has been prevented from doing so. This can happen:

  • If a logged-in user tries to access a page or resource restricted to certain users or IP addresses.
  • If a user logs into a page or portal but they’ve been idle for too long and the session times out.

What to do about it: If someone reaches out to you with this error and they’re supposed to have access to that part of the site, check your permissions and settings. There may be a rule preventing them from accessing it.

If the issue is a timed-out session, then you may need to evaluate what the session threshold is. If it’s generally too short, then you might want to extend the expiry time so that users stop running into the error.

Then again, you have to weigh the pros and cons of an extension. For example, do you really want banking website customers to be logged in and idle for more than a few minutes? The longer they’re allowed to remain idle, it increases the chances of a nefarious actor hijacking their session.

So the better solution there would be to add a visible timer that appears on their screen to let them know how much time remains and then to automatically log them out when the session ends. That way, they won’t return to their screen and think that they can just re-engage with the site.

HTTP Error Code 404

Error message: 404 Not Found

When does it happen: This error occurs when someone tries to open a page that cannot be found on the server. This has one of a few causes:

  • The URL was incorrectly typed into the browser by the end user.
  • The user clicked on an outdated link in search results, on social media or on the page of another website.
  • Your website has a link to a page that no longer exists or has since been renamed.

What to do about it: There are a number of things you can do to remedy this issue.

First is to make sure you have a well-structured navigation as well as a companion search bar. If users do encounter a 404, you want to give them tools that will help them quickly get back on track.

Second is to ensure that your XML sitemap is directly connected to Google through Google Search Console (GSC). The search engine should always have the most up-to-date sitemap—with current and correct links.

Third is to manage your URL edits properly. There are a number of things you’ll need to do:

  • Set up a 301 redirect so that users are automatically directed to the new URL if they try to access the old one.
  • Update the old link everywhere it exists on your website.
  • Go into GSC and submit a Removal request. Then resubmit your sitemap if it hasn’t been updated recently.

If you’ve permanently removed a page from your site, a 301 is still a good idea. Just make sure that you direct visitors to a page that won’t totally confuse customers. For instance, if they try to access a product page that no longer exists, don’t send them back to the homepage to start over. Send them to a related product page or the top-level category page instead.

HTTP Error Code 408

Error message: 408 Request Timeout

When does it happen: There are two types of timeout errors that are common. The 408 timeout usually means that the client is unable to process the request during a specific amount of time. In some cases, this error occurs because the server fails to process the request in a timely manner.

These are some of the common causes for this error:

  • The user has a slow internet connection and it’s taking too long to process any online requests.
  • An incorrect or invalid URL is provided and the client is stuck in a loop trying to figure out where to direct the user.
  • There was a recent software update that led to an error in the code or a conflict with another piece of software.
  • The server is running slowly.
  • The website is currently experiencing a distributed denial of service (DDoS) attack and is inaccessible.

What to do about it: Start by eliminating the client as the source of the error. Attempt to reach the specific URL from your own end. If it’s fine, then you know that the issue is coming from the end user’s side of things.

Check their internet connection and if it’s prohibiting them from accessing the web as a whole or just your site.

If it’s just your site and, specifically, one page, examine the URL. If the syntax is incorrect, what should happen next? If you haven’t configured a 301 redirect, then they should see a 404 error page. If there are too many redirects configured for the URL, then that may be the issue.

If it’s not a problem on the client side, then it’s time to look at your website and server. Start by reviewing your logs. Has any software been updated recently? If so, a number of things could’ve happened:

  • Bad code might have been installed in the process.
  • New or updated software could have a conflict with existing software.
  • An old file may have been left behind by an uninstalled program.

To identify the source, uninstall all software or roll the site back to a previous version. If the site returns without the 408 error, then the error is here. You’ll have to reinstall each piece of software one at a time to find out which one is the problem.

If everything is fine with your software, the next place to turn is your web host. Check on the server status. If everything is fine as a whole, then it could be your hosting server specifically. Your provider will help you figure out if there’s an issue with your resources or if your site has been breached.

HTTP Error Code 500

Error message: 500 Internal Server Error

When does it happen: This refers to a general server-side error. 500 doesn’t tell us anything specific about why the error occurred except that it originated at the server. It could be due to various reasons—for example, the server might be down, hacked or overloaded.

What to do about it: Because this error is so non-specific, the first thing to try is clearing your browser. You never know. It could be a temporary glitch.

If that doesn’t work, contact your hosting provider. They should be able to tell you if the error originated with their server facilities or if it’s your specific hosting space. You can then implement a fix based on the information they provide to you.

HTTP Error Code 502

Error message: 502 Bad Gateway or 502 Temporarily Overloaded

When does it happen: This error means that there’s something wrong with the server connection. This could be due to:

  • The hosting servers being down.
  • Your hosting space and resources exceeding capacity.
  • A security breach at the server level.

What to do about it: This is another one of those errors that you’ll need your web host’s assistance with.

Start by going to their Status page to see if anything is going on there. If their servers are down, then you know what’s going on and will have to wait it out.

If the servers are online, then you’ll need to see what’s going on with your own site. If your server and resources have been exceeded, it could be for a number of reasons.

For instance, your site may be dealing with a traffic surge due to a huge sale you’re running or a piece of content that has gone viral. If you don’t have sufficient resources to handle the uptick in traffic, then the solution is to scale up those resources or move to a larger hosting plan.

On a side note, this is why stress testing is important for websites. It will allow you to see how far your site and server can be pushed before it goes offline.

The other reason why your resources may be getting maxed out is a DDoS attack. Work with your hosting provider to kick out the offending IP addresses. They may also have to redirect your website traffic through a different server or CDN in the meantime.

HTTP Error Code 503

Error message: 503 Service Unavailable

When does it happen: This is a generic error code that tells us that the server is currently offline. This may reflect a permanent or temporary issue.

Here are some reasons why you might see this error code:

  • The website is undergoing maintenance.
  • Software is currently being updated and the server is restarting.
  • The server is overloaded and can’t process any further requests.

What to do about it: Unless you have initiated a specific task, it’s going to be hard to know what caused this error. So the first thing to do is wait a few minutes and then retry the request. It could just be temporary.

If the error persists, get in touch with your hosting provider. They can provide you with details about why your server is unable to respond and help you get unstuck.

HTTP Error Code 504

Error message: 504 Gateway Timeout

When does it happen: This is the other timeout error code I was referring to. While 408 can refer to timeout caused by the client or the server, 504 strictly refers to server-side errors.

You’re going to see this error when the server fails to produce a result within a given timeframe. This could be a temporary availability issue or it could be something specific to the request you’re sending to the server. For example, if someone tries to upload a file to a contact form and that file size is too large, it could end up erroring out the whole page.

What to do about it: The first thing to do is wait a few minutes and then retry whatever it was you were doing on the site.

If it still doesn’t work, check your web hosting provider’s Status page to see if there are any issues.

If the server is fine, then review the specific request you are making. Like the example of the oversized file above, it could be as simple as asking too much from your server resources.

There are a couple of ways to deal with that type of issue. One option is to provide clearer instructions on your webpage about what is and what isn’t allowed (e.g., file sizes, maximum number of characters, etc.). That will cut down on the number of 504 errors that appear.

Another option is to update your php.ini file and increase the maximum amount of execution time. I would only recommend doing this if it’s a one-off case and you’re desperate to get the request processed (like if you’re waiting on a file from a client). Or if you’ve found that users are constantly running into this issue and there’s no way to get around it but increasing the execution time.

If none of that works, get in touch with your hosting provider and see what else could be going on. They should be able to see why the response time is longer than usual and leading to a timeout instead of a result.

Wrap-up

It’s never fun when visitors run into issues with our websites. However, by learning what the various 4xx and 5xx HTTP error codes mean, you can put various plans in place to deal with those specific issues when they arise.

From software conflicts to overloaded servers, there’s a wide variety of things that can go wrong. While it’s important to know how to fix these errors when they arise, it’s just as important to put safeguards in place to reduce the likelihood that they happen.

For instance, if you worry about downtime issues with your web hosting provider, you should start shopping around for a more reliable provider and also add a CDN as a form of failover. Also, setting up a system to monitor for common issues like server downtime, broken links and security attacks will be a huge help. The more you can do now to minimize HTTP errors, the less time you’ll have to spend dealing with them down the road.


SuzanneScacca-headshot
About the Author

Suzanne Scacca

A former project manager and web design agency manager, Suzanne Scacca now writes about the changing landscape of design, development and software.

Related Posts

Comments

Comments are disabled in preview mode.