Blog |

A Web Developer’s Guide to Common Website Error Codes

A Web Developer’s Guide to Common Website Error Codes
Table of Contents

To err is not only human but also a fairly common occurrence on the world wide web. From misconfigured servers to mistyped URLs, three-digit error codes can turn an otherwise smooth browsing experience into a frustrating detour. From the infamous 404 to the more elusive 500, this guide is your compass to troubleshoot, decode, and resolve these digital stumbling blocks.

1. 404 Not Found

“404 Not Found” is one of the most common website errors. It indicates that the server was unable to find the requested resource. This could be due to a broken link, a mistyped URL, or the resource being removed or relocated.

Example of error code 404 not found
Example of error code 404

Ways to resolve a 404 error:

  • Examine any broken links. It's possible that a website has broken links that are to blame for the issue. To find any broken links the programmer or the website owner can use tools like Google Search Console or a link checker, and then fix them by changing the URL or eliminating the link entirely.
  • Redirect the URL: The programmer can redirect the URL to another page on the website if the user is attempting to visit an outdated page. This can ensure that consumers can still obtain the information they need without getting a 404 error.
  • Ask the user to delete their cache and cookies: A 404 error occasionally results from a cached copy of a website that is no longer available. The users can make sure the most recent version of the page is accessed by clearing their cache and cookies.

2. 500 Internal Server Error

The 500 error number denotes a server error that prevented the server from processing the request. A misconfiguration, a defect in the code, or a problem with the server hardware could all be to blame for this.

A user might get a 500 error page, for instance, if they attempt to submit a form on a website and the server detects a problem while handling their request.

Example of error code 500 internal server error
Example of error code 500

Ways to resolve a 500 error:

  • Investigate the server logs: Information regarding the reason for the 500 Internal Server Error can be found in the server logs. To find any problems or faults, look through the error log files on the server. The error may be resolved by resolving the underlying problem.
  • Disable plugins or themes: If a WordPress site experiences a 500 Internal Server Error, a problematic plugin or theme may be to blame. To see if the error is fixed, disable all the plugins and switch to the default WordPress theme. The culprit can then be found by turning on each plugin individually.

3. 503 Service Unavailable

The 503 error code denotes a temporary outage or the server's inability to fulfill the request at that particular time. This can be because the server is undergoing maintenance, there is a lot of traffic overloading the server, or there is a hardware problem.

For instance, if an attempt to access a well-known website during peak hours is made and the server is overwhelmed by the number of requests, a 503 error page is encountered.

Example of error code 503 service unavailable
Example of error code 503

Ways to resolve a 503 error:

  • Check the server status to see if there are any known issues or outages. If the server is down or experiencing issues, you may need to wait until it's back online.
  • Investigate the server logs.
  • Check for resource restrictions, such as low memory or CPU utilization, and make the necessary configuration adjustments.
  • To check if a misconfiguration or outage is the cause of a 503 problem, disable the CDN or the proxy.
  • Contact the web host

4. 400 Bad Request

The server was unable to understand the request owing to improper syntax, as shown by the 400 error code. It's possible that the client sent an invalid request, such as one with missing arguments or one with improper syntax, which is the cause of this.

A 400 error page might appear, for instance, if a user tries to access a page on a website with an invalid URL.

Example of error code 400 bad request
Example of error code 400

Ways to resolve a 400 Bad Request error:

  • Verify the request headers: A 400 Bad Request error can occasionally be caused by the request headers. Verify the headers to make sure they are legitimate and formatted correctly. To examine the headers, you can employ a tool like “Fiddler”.
  • Verify the URL: If the URL attempted to visit is incomplete or incorrect, “400 Bad Request” error may occur. Verify the URL a second time to be sure it is accurate and formatted correctly. Crawl the site to see what pages have links that point to this URL.
  • Verify the data for invalid characters: If you are sending data to the server or submitting a form, the 400 Bad Request error may appear. Look over the data for any special characters or symbols, and if you find any, eliminate them.
  • Ask the user to disable browser extensions: A browser extension can be the reason why you are receiving a 400 Bad Request error on a particular website. Check to see if the error is fixed by disabling all extensions before attempting to access the website once more.

5. 504 Gateway Timeout

When the gateway or proxy server does not receive a timely response from the upstream server, the 504 error code occurs. This can be caused by a sluggish or overcrowded upstream server, a network problem between the two servers, or another factor.

A 504 error page might appear, for instance, if you try to access a website that uses a third-party API and the API is sluggish or unresponsive.

Example of error code 504 gateway timeout
Example of error code 504

Ways to resolve a 504 Gateway Timeout:

  • Refresh the page.
  • Check the server status with the help of server status checker tools.
  • Check the server logs.
  • Check for resource limitations.
  • Increasing the timeout limit can help resolve the 504 Gateway Timeout error. You can do this by modifying the server configuration settings or using a plugin or tool that allows us to adjust the timeout limit.
  • Contact the web host.

6. 401 Unauthorized

The 401 error code signifies that, although user authentication is required for the request, the user has not provided valid credentials. This can be because the user entered their login information incorrectly or because the server failed to recognize their credentials. For instance, you might encounter a 401 error page if you attempt to access a protected resource on a website without logging in.

Example of error code 401 unauthorized
Example of error code 401

Ways to resolve a 401 error:

  • Check the server settings: Server configuration errors can potentially result in 401 Unauthorized errors. Make sure that the resource you are trying to access is configured appropriately and that the server settings are set up correctly.
  • Check for a SSL certificate: If you are attempting to visit a resource using HTTPS, and if the SSL certificate has issues, the 401 Unauthorized error might occur. Verify the SSL certificate's validity and configuration.
  • Verify credentials: Make sure the login information you're using to access the resource is accurate by checking the username and password.

7. 403 Forbidden

The 403 error code indicates that the server acknowledged the request but refused to fulfill it. This can be because access to the resource is denied, or the server might be set up to deny access to the requested resource.

For instance, the users will probably encounter a 403 error page if they attempt to visit a directory on a website that requires a password.

Example of error code 403 forbidden
Example of error code 403

Ways to Resolve a 403 Error:

  • Check permissions: Check if the user has the necessary permissions to access the resource and adjust the settings accordingly.
  • Check for IP address restrictions: The 403 Forbidden error can occur if the server has IP address restrictions in place. Check if the IP address is allowed to access the resource and adjust the security settings if necessary.

8. 502 Bad Gateway

The 502 error code suggests that the gateway or proxy server received an incorrect response from the upstream server. This can be caused by a server setup error or a problem with network connectivity.

A 502 error page might appear, for instance, if you try to access a website that uses a third-party API and the API is broken or unresponsive.

Example of error code 502 bad gateway
Example of error code 502

Ways to resolve a 502 error:

  • Check for server overload: A 502 Bad Gateway error can occur when the server is overloaded and unable to handle the request. Check if the server is overloaded by checking the server logs.
  • Check the server configuration: Check the server configuration to ensure that it's set up correctly and that access to the resource is configured properly.
  • Check for proxy server issues: If accessing the website through a proxy server, the 502 Bad Gateway error can occur due to issues with the proxy server.

9. 301 Moved Permanently

The 301 error code signifies a permanent relocation of the requested resource to a different URL. This might be the result of a website makeover, an alteration to the URL scheme, or a new domain name.

Ways to resolve a 301 redirect:

  • Update the link: The link can be updated to point to the new location of the content. This will guarantee that users are directed to the appropriate page and that the 301 error is fixed.
  • Ask the user to check for typos in the URL.

10. 408 Request Time-out

The 408 error code is the result of the server timing out and closing the connection due to not producing a request quickly enough. A slow network connection or a server that is overworked and unable to respond promptly could be to blame for this.

Example of error code 408 request timeout
Example of error code 408

Ways to resolve a 408 Request Time-out:

  • Check the server configuration.
  • Increase the timeout limit.
  • Ask the user to disable browser extensions.

Be proactive

Encountering website errors is an inevitable aspect of the internet, frustrating for users, website owners, and developers alike. However, armed with awareness of the various error types, their roots, and remediation strategies, we as developers can swiftly address these issues, minimizing disruption and restoring website functionality.

Moreover, leveraging error monitoring tools like Rollbar can make the process even smoother. Managing errors in your code can seem daunting, possibly making the deployment of production code a nerve-wracking experience. However, with the ability to track, analyze, and manage errors in real-time, you can proceed with increased confidence. Rollbar automates error monitoring and triaging, making fixing errors easier than ever. Try it today!

Related Resources

"Rollbar allows us to go from alerting to impact analysis and resolution in a matter of minutes. Without it we would be flying blind."

Error Monitoring

Start continuously improving your code today.

Get Started Shape