Understanding HTTP Error Codes and Troubleshoot Them

Understanding HTTP Error Codes and Troubleshoot Them

Clock Icon2023.05.22

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

There are times when you might encounter an error page instead of the website you intended to visit when browsing the Internet. There are often three-digit HTTP status codes on these error pages, such as "404 Not Found" or "500 Internal Server Error." These HTTP status codes let you know what went wrong.

I always come across different error codes but I am still not well versed with them. So I thought of putting them all together at one place for simplicity. If you are also like me, then you are reading the right blog. Let's get started!

1. 401 Unauthorised

First on our list of HTTP error codes is 401. A 401 message means the server received an unauthenticated request. In this error, a message announces that the page couldn’t load because of invalid credentials for whatever reason.

How to fix it?

It could be possible the login URL has changed, or the URL you entered is incorrect. However, if that’s not the case, try clearing the browser cache and cookies.

2. 404 Not Found

One of the most commonly encountered HTTP error codes, a 404 Not Found error indicates that the server couldn't find the requested resource.

How to solve it:

If you encounter a 404 error, check the URL you entered to make sure it's correct. If the URL is correct, the page might have been removed or moved to a new URL. You could try reaching out to the website administrators or using a search engine to find what you're looking for.

3. 403 Forbidden

A 403 Forbidden error means the server understands your request, but it refuses to fulfil it. This could be because you don't have the necessary permissions to access the resource.

How to solve it:

If you encounter a 403 error, make sure you have the necessary permissions to access the page. This might require logging in, or it could mean that your IP address is blocked by the server. If you think you should have access, consider contacting the website administrators.

4. 500 Internal Server Error

A 500 Internal Server Error is a generic error message, given when no more specific message is suitable. It indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

How to solve it:

A 500 error typically requires intervention from the website's server administrator, as the issue is on the server side. As a user, you can try refreshing the page, clearing your cache and cookies, or coming back later.

5. 502 Bad Gateway

A 502 Bad Gateway error means that one server received an invalid response from another server it was communicating with to fulfil your request.

How to solve it:

Most 502 errors are due to temporary issues and are often resolved simply by refreshing the page a few minutes later. If the problem persists, it might be a good idea to contact the website administrators.

6. 504 Gateway Timeout

A 504 Gateway Timeout error happens when a server didn't receive a timely response from another server that it was accessing while attempting to load the web page or fulfil another request by the browser.

How to solve it:

Just like 502 errors, 504 errors are often temporary and can be resolved by refreshing the page after a few minutes. If you continue to see this error, contact the website administrators.

7. 301 Moved Permanently

A "301 Moved Permanently" is a HTTP status code indicating that the URL of the requested resource has been changed permanently. The new URL is given in the response. This status code is used for permanent URL redirection. Unlike other error codes like 404 or 500, a 301 status isn't exactly an error, but a redirection.

How to solve it:

Visitors to a website who encounter 301 redirects will be taken to the new URL automatically by their browsers. Web developers may see unexpected 301 responses due to a misconfiguration on their server or in their code. Ensure the URLs are configured correctly in your site's code and in any .htaccess file your server might be using. Check that URLs are being redirected correctly.

In case you're the website owner, and you've moved your content to a new URL, make sure to set up a 301 redirect from your old URL to the new one.

8. 302 Found

This HTTP status code is similar to the 301, but it is used for a temporary redirect. This response tells Google that the page is moved temporarily and will be back to the original URL at some point. If done correctly, it will redirect the user to another URL in a couple of seconds.

How to solve it:

For regular internet users, a "302 Found" redirect is usually automatically handled by the browser. If issues persist, try clearing your browser's cache and cookies or switch browsers. For web developers, unexpected 302 redirects may suggest server or code misconfigurations. Key steps to remedy this include reviewing your website's code and server configuration, considering a permanent 301 redirect if applicable, and utilising web development tools for debugging.

Conclusion

Remember, when you encounter an HTTP error, it's usually not your fault. Most of these errors are server-side issues that require intervention from the website administrators or server operators. However, knowing what these error codes mean can help you better understand what's going on and might even help you solve some issues on your own.

Thank You!

Happy Learning:)

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.